-
Notifications
You must be signed in to change notification settings - Fork 219
Description
i’m finding an issue when making box sdk requests from a django app which runs with multiple worker processes. the scenario seems to be that one process makes a request which results in token auto-refresh. after this, any other worker process which makes a request will fail due to a now-expired token + expired refresh token.
the exception is
BoxOAuthException:
Message: {"error":"invalid_grant","error_description":"Invalid refresh token"}
Status: 400
URL: https://api.box.com/oauth2/token
Method: POST
the stack trace is
boxsdk/session/box_session.py ? in _retry_request_if_necessary
boxsdk/session/box_session.py ? in _renew_session
boxsdk/auth/oauth2.py ? in refresh
boxsdk/auth/oauth2.py ? in _refresh
boxsdk/auth/oauth2.py ? in send_token_request
one possibility is to add a a pre-refresh callback, similar to the OAuth2._store_tokens callback.