shauntarves / wyze-sdk

A modern Python client for controlling Wyze devices.
The Unlicense
306 stars 50 forks source link

What is the expiry time on the access token - it isn't 2 days like the documentation says #175

Open dwaynez opened 5 months ago

dwaynez commented 5 months ago

I get a token and then I use it every now and again. When I go to use it 26 hours after the email login, it fails on 'token expired'. Anyone have better experience with the life span of the access token? Also the documentation says that the refresh token has a lifespan of 30 days. Anyone have verification of this? This is the documentation that I am referring to: https://support.wyze.com/hc/en-us/articles/16129834216731-Creating-an-API-Key

bmatticus commented 2 months ago

If you take the jwts and decode them, it looks like the access token is just under 2 hours currently and the refresh is 28 days:

print(b64decode(f"{at.split('.')[1]}==")) b'{"aud":["oauth2-resource","native_oauth2_resource"],"user_id":"***","user_name":"**","scope":["native"],"iss":"https://auth.wyze.com","created_at":1720391946,"exp":1720397946,"authorities":["USER"],"jti":******","client_id":"**"}' 1720397946-1720391946 6000 (1720397946-1720391946) / 3600 1.6666666666666667

print(b64decode(f"{rt.split('.')[1]}")) b'{"aud":["oauth2-resource","native_oauth2_resource"],"user_id":"**","user_name":"**","scope":["native"],"ati":"**","iss":"https://auth.wyze.com","created_at":1720906453,"exp":1723325653,"authorities":["USER"],"jti":"******","client_id":"**"}' 1723325653-1720906453 2419200 (1723325653-1720906453) / 86400 28.0