-
-
Notifications
You must be signed in to change notification settings - Fork 420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible to auto refresh client_credentials access token? #260
Comments
I don't see any problem with adding some logic to |
I am having similar issues. |
I solved this issue by subclassing oauthlib's
Then you can pass such a client to But, indeed, a solution that doesn't require custom code would be most welcome. |
Is anyone working on a solution to this? The suggestion from @IvanAnishchuk doesn't seem to do the trick for me. The only way I manage to make it work is by catching It looks to me like there's some non-trivial refactoring that is required to make this work well. It's not clear to me exactly where the line is drawn between the Client and the Session and what the responsibility of each is. It also doesn't make sense to me that client ID is a required parameter for Could someone help me out here? Is the client_credentials really still not fully supported? Is there anything we can do to make it happen? |
Unfortunately, probably not. See #385 for more context. |
As a
client_credentials
based access token has no refresh token, therefresh_token()
functionality raises an exception (ie.InvalidRequestError: Missing refresh token parameter.
). Based on the spec, I believe this is technically fine - one should fetch a new access token in this case.Is it just the spec that prevents
requests-oauthlib
from handling this scenario gracefully alongside the current token expiration code handling in therequest()
method onOAuth2Session
?If I subclass
OAuth2Session
like so:I can use it like this:
As long as
auto_refresh_url
is not passed in, the logic in my subclass handles everything smoothly. Could logic be added torequest()
to cover this scenario, rather than having to kludge this as I've done?Related thread: https://groups.google.com/d/msg/django-oauth-toolkit/iSIiZQtn0mM/5SDckbyTCQAJ
The text was updated successfully, but these errors were encountered: