SecKatie / wyzeapy

36 stars 26 forks source link

Token Refresh #18

Closed JoeSchubert closed 3 years ago

JoeSchubert commented 3 years ago

This change should prevent multiple threads from trying to refresh the token at the same time.

Additionally, there's no reason to refresh the token hourly when it's good for 60 hours, so we should be fine refreshing every 48 hours. I don't seem much reason to check that the refresh token is still valid since it is good for ~2 years. At that point... a user should really expect to have to re-login.

These changes should make it a little easier to store the tokens externally and pass them back to the library so that a re-login is not required each time the library is re-initialized by an application. The token will just need to be passed back in during the create() call.