Terrance/SkPy

Email Login skype

Opened this issue · 3 comments

Before we start...

  • I've searched existing issues, but my problem hasn't been reported yet.
  • I've read the documentation (including notes on error messages and rate limiting), but my problem is something else.
  • I've tested the behaviour on Skype for Web, and it works there but not with SkPy.

Summary

When I log in to skype using my email, trying to refresh the token throws an exception, and logging in using my mobile number doesn't matter

Code sample

sk = Skype('my email', 'my pwd') # connect to Skype
print(sk.conn.tokenExpiry)
sk.conn.refreshSkypeToken()

Code output

{'skype': datetime.datetime(2024, 6, 26, 15, 8, 48), 'reg': datetime.datetime(2024, 6, 26, 15, 8, 49)}
Traceback (most recent call last):
  File "d:\Desktop\20240618\test2.py", line 17, in <module>
    print(sk.conn.refreshSkypeToken())
  File "C:\ProgramData\miniconda3\lib\site-packages\skpy\conn.py", line 502, in refreshSkypeToken
    self.tokens["skype"], self.tokenExpiry["skype"] = SkypeRefreshAuthProvider(self).auth(self.tokens["skype"])
  File "C:\ProgramData\miniconda3\lib\site-packages\skpy\conn.py", line 892, in auth
    t = self.sendToken(token)
  File "C:\ProgramData\miniconda3\lib\site-packages\skpy\conn.py", line 906, in sendToken
    raise SkypeAuthException(errMsg, loginResp)
skpy.core.SkypeAuthException: ('', <Response [200]>)

Explain your code

First create a skype object by instantiating it,Then check the expiration time of the token ;Finally, manually refresh the token to extend the token time

SkPy version

0.10.7

Python version

3.10.11

Anything else?

No response

  • Set the SKPY_DEBUG_HTTP=1 environment variable so that requests to the Skype API are logged.
  • Make sure to redact any personal information -- authentication tokens, passwords, usernames, email addresses, contact details etc.

That said, why are you immediately refreshing your token? You've printed the expiry time which should have been valid for a day, and SkPy handles refreshing the token for you.

  • Set the SKPY_DEBUG_HTTP=1 environment variable so that requests to the Skype API are logged.
  • Make sure to redact any personal information -- authentication tokens, passwords, usernames, email addresses, contact details etc.

That said, why are you immediately refreshing your token? You've printed the expiry time which should have been valid for a day, and SkPy handles refreshing the token for you.

This is just a test, because I want to stay logged in for a long time and store my chat messages persistently for message backup.
I don't want to log in again every time, if I log in again, I have to back up my messages again, I don't want to do repeated backup work, so I will manually refresh the token to keep my login status.

As noted above, SkPy will refresh tokens at the appropriate point -- you should not be manually refreshing your tokens. If you're doing it unnecessarily often and getting errors as a result, Skype may well be rate-limiting you.

If you've had a failed automatic token refresh (without manual attempts) then please post the full logs at that point.