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
But now the approach throws "Invalid URL 'None': No scheme supplied. Perhaps you meant https://None?". As I understand, it's because ensure_active_token method sees "client_credentials" grant type and tries to update the token automatically via "token_endpoint", which is not set.
In my case I can't just add token_endpoint=api_url to OAuth2Session initialization, because the endpoint also requires suitable headers. At the same time ensure_active_token method always calls fetch_token with default headers.
Describe the solution you'd like
I would like to see any of 3 possible solutions:
pass, store and use automatically custom auth/get headers during instantiating of OAuth2Session class, which will make auto-update feature suitable for such cases
add some kind of "token_auto_update" boolean flag in OAuth2Session constructor which will enables/disables auto-update feature
throw more meaningful exception if "toke_endpoint" kwarg is not set, e.g. MissedTokenEndpointError or TokenAutoUpdateError instead of MissingSchema
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
My data supplier uses HTTP headers to route requests, so I have to add suitable headers to
fetch_token
andget
methods to reach correct API endpoint:And previously I handled token expiration by try..except block and get new token "manually":
But now the approach throws "Invalid URL 'None': No scheme supplied. Perhaps you meant https://None?". As I understand, it's because
ensure_active_token
method sees "client_credentials" grant type and tries to update the token automatically via "token_endpoint", which is not set.In my case I can't just add
token_endpoint=api_url
to OAuth2Session initialization, because the endpoint also requires suitable headers. At the same timeensure_active_token
method always callsfetch_token
with default headers.Describe the solution you'd like
I would like to see any of 3 possible solutions:
The text was updated successfully, but these errors were encountered: