You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a use case were sometimes my stored users' tokens expire and thus they need to reauthenticate into whatever app I'm trying to request data from.
In these cases I get an error 400 from the api I'm requesting from and simply ask my user to reauthenticate using my usual oAuth2 flow.
Since I don't know exactly when a token will expire my current approach is to wrap every request I make to these apis in a try catch and then handle the exception from there.
I noticed that there are some compliance hooks and was wondering if it would be appropriate to add something like a refresh_token_exception hook to be called if the library runs into an error code while refreshing the token as opposed to just calling the usual refresh_token_response with the raw response.
If this makes sense I would be happy to submit a pull request for it
I have a use case were sometimes my stored users' tokens expire and thus they need to reauthenticate into whatever app I'm trying to request data from.
In these cases I get an error 400 from the api I'm requesting from and simply ask my user to reauthenticate using my usual oAuth2 flow.
Since I don't know exactly when a token will expire my current approach is to wrap every request I make to these apis in a try catch and then handle the exception from there.
I noticed that there are some compliance hooks and was wondering if it would be appropriate to add something like a
refresh_token_exception
hook to be called if the library runs into an error code while refreshing the token as opposed to just calling the usualrefresh_token_response
with the raw response.If this makes sense I would be happy to submit a pull request for it
requests-oauthlib/requests_oauthlib/oauth2_session.py
Line 94 in 3a2a852
The text was updated successfully, but these errors were encountered: