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
To make the auto-refresh procedure work with our oauth2 server I discovered that I had to create the token_updater function myself, and that it was this very simple one-liner:
oauth_session=OAuth2Session(client=my_oauth_client, # the client knows the scope alreadyauto_refresh_url=refresh_token_url,
auto_refresh_kwargs={'client_id': client_id,
'target': client_id,
'api_type': refresh_api_type},
# Until PR is accepted the scope need to be repeatedscope=scopes# https://github.com/requests/requests-oauthlib/pull/409
)
# HERE: could we get rid of this code by default ?# the update procedure that will be called on successful token refreshdeftoken_updater(new_token):
oauth_session.token=new_tokenoauth_session.token_updater=token_updater
Am I right to think that the last three lines of code could be done automatically by default ?
If so I can propose a PR
The text was updated successfully, but these errors were encountered:
smarie
changed the title
Provide a default token_updater that just replaces
Provide a default token_updater that just replaces self.tokenApr 15, 2020
smarie
changed the title
Provide a default token_updater that just replaces self.tokenOAuth2Session: Provide a default token_updater that just replaces self.tokenApr 15, 2020
To make the auto-refresh procedure work with our oauth2 server I discovered that I had to create the
token_updater
function myself, and that it was this very simple one-liner:Am I right to think that the last three lines of code could be done automatically by default ?
If so I can propose a PR
The text was updated successfully, but these errors were encountered: