-
-
Notifications
You must be signed in to change notification settings - Fork 795
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
access_token
on URL causes half-authenticated users
#547
Comments
This is currently not working, and causes the strange case where the token is validated (so invalid tokens are still rejected, which is good) but `request.user` is still set to an AnonymousUser instance. This is [reported upstream as bug 547](jazzband/django-oauth-toolkit#547)
To address this issue, you can manually authenticate the user using the provided access token inside your view function. Here's how you can do it:
By manually checking for the presence of the Please note that manually handling token authentication may not be the most elegant solution, but it should work as a workaround until the issue is addressed in a future version of django-oauth-toolkit. Additionally, you might want to consider upgrading to the latest version of Django and django-oauth-toolkit if possible, as newer versions might have addressed this issue or provided a more straightforward solution for token authentication. |
Testing with Django 1.11.9 and django-oauth-toolkit 1.1.0, I get strange results when passing
access_token=xxxx
as query string on a GET request. This is my view:Taking a valid access token, I can GET the URL, get through the
protected_resource()
decorator, but it doesn't properly setrequest.user
:So then we have a strange hybrid of having properly authenticated a user, but still the view code not knowing anything about this.
This may be related to #533.
The text was updated successfully, but these errors were encountered: