Open smarie opened 4 years ago
I think a default updater would be beneficial. I think you'll also need to set access_token. Maybe something like this within the OAuth2Session class:
def token_updater(self, token):
self.token = token
self.access_token = token['access_token']
I think the issue is that client updates only happen if there is a token updater set (see https://github.com/requests/requests-oauthlib/blob/master/requests_oauthlib/oauth2_session.py#L537). If we move the self._client.add_token
call outside of the if
check, defining a default token_updater
won't be necessary
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