yahoo-oauth icon indicating copy to clipboard operation
yahoo-oauth copied to clipboard

refresh token does not update token in session

Open craigham opened this issue 4 years ago • 3 comments

Thanks for a great library.

I have a process which is very long running, and I am having trouble with auth token expiring. This is despite my calling the refresh_token method.

I think I may have found the problem.

In the constructor the following is called: # Getting session if self.oauth_version == 'oauth1': self.session = self.oauth.get_session((self.access_token, self.access_token_secret)) else: self.session = self.oauth.get_session(token=self.access_token)

However, I don't think that session variable is getting updated with the new access token.

Does this make sense?

Thanks, Craig

craigham avatar Mar 21 '20 23:03 craigham

if I put this below my call to refresh_access_token this works as a work around.

oauth.session = oauth.oauth.get_session(token=oauth.access_token)

I have a periodic task which has worked well past an hour now, maintaining valid credentials.

craigham avatar Mar 22 '20 14:03 craigham

Doesn't the example in the documentation work ?

josuebrunel avatar May 24 '20 15:05 josuebrunel

The example appears to work, in that it gets a new access token and resets the token_time variable. However requests continue to be sent with the old access token, which then begin failing 60 seconds later when the old access token expires.

The workaround by @craigham does work.

jeremywww avatar Sep 27 '21 23:09 jeremywww