Terrance/SkPy

Impossible to refresh token

Closed this issue · 1 comments

Hello,
I'm using this library to manage skype chats. I want to auth me just one time and after everyday refresh the token.
Here my code to refresh the token :

def auto_refresh_token_skype() : 
  sk = Skype(connect=False,tokenFile=".tokens-skpy")
      try:
          sk.conn.readToken()
      except SkypeAuthException:
          # Prompt the user for their credentials.
          sk.conn.setUserPwd(MYUSERNAME, getpass())
  sk.conn.refreshSkypeToken()

The exception raised by the refreshSkypeToken() method :

Traceback (most recent call last):
  File "/home/valentin/.local/lib/python3.8/site-packages/apscheduler/executors/base.py", line 125, in run_job
    retval = job.func(*job.args, **job.kwargs)
  File "/home/valentin/Projets/RogueTools/RogueToolsApp/dashboard/robot.py", line 88, in auto_refresh_token_skype
    sk.conn.refreshSkypeToken()
  File "/home/valentin/.local/lib/python3.8/site-packages/skpy/conn.py", line 462, in refreshSkypeToken
    self.tokens["skype"], self.tokenExpiry["skype"] = SkypeRefreshAuthProvider(self).auth(self.tokens["skype"])
  File "/home/valentin/.local/lib/python3.8/site-packages/skpy/conn.py", line 855, in auth
    t = self.sendToken(token)
  File "/home/valentin/.local/lib/python3.8/site-packages/skpy/conn.py", line 869, in sendToken
    raise SkypeAuthException(errMsg, loginResp)
skpy.core.SkypeAuthException: ('', <Response [200]>)

A strange Exception and my token is not updated.
PS: The response[200] contains an html login page to Microsoft account, if it can helps.

Why are you calling the refresh endpoint at all? A new token will be acquired for you if the current one has expired.

refreshSkypeToken() calls an old Skype endpoint that likely no longer works (see #159). Token files are also mostly useless these days as Skype seems to no longer support extending your session without doing a full login again.

Read the docs for the suggested way to handle authentication.