Terrance / SkPy

An unofficial Python library for interacting with the Skype HTTP API.
https://skpy.t.allofti.me
BSD 3-Clause "New" or "Revised" License
259 stars 65 forks source link

Email Login skype #264

Open JingjingZhu6688 opened 2 weeks ago

JingjingZhu6688 commented 2 weeks ago

Before we start...

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

Terrance commented 2 weeks ago
  • 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.

JingjingZhu6688 commented 2 weeks ago
  • 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.

Terrance commented 2 weeks ago

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.