It does not support Django Rest Framework token authentication backend
See original GitHub issuewhen I try to access info.context.user it all the time returns anonymous user, my same code works fine with django-graphql-jwt
Debugging gives me this :
-> return self.middleware
(Pdb) self.middleware
[<graphene_django.debug.middleware.DjangoDebugMiddleware object at 0x7fb93ac8d590>]
(Pdb)
Means that no auth middleware has been set to the graphql view
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
Top Results From Across the Web
Authentication - Django REST framework
This means that only authenticated requests require CSRF tokens, and anonymous requests may be sent without CSRF tokens. This behaviour is not suitable...
Read more >Token authentication not working django rest framework
I am using token authentication for my current project but I have one problem, I can not authenticate a use for the life...
Read more >Token Authentication for django-rest-framework - /var/
This means that if you have a server api.example.com that is used as a backend and a server www.example.com that will serve your...
Read more >Django Rest Framework authentication: the easy way
Django Rest Framework authentication in your web application should be easy and secure. Forget JWT and use the good-old Django sessions in ...
Read more >How to Implement Token Authentication using Django REST ...
In this tutorial you are going to learn how to implement Token-based authentication using Django REST Framework (DRF).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To support DRF Token Authentication Backend I wrote a class which derives from GraphQLVIew.
(edit) added the imports
@vinayan3 Thanks for posting your code!
Question…did you ever try adding SessionAuthentication to your
authentication_classes
?Doing so is helpful if you want logged in users to be able to access the GraphiQL UI. However, when I tried adjusting the code you posted like so:
authentication_classes = [TokenAuthentication, SessionAuthentication]
It fails when DRF tries looking for request._request as part of the sessions auth check.
'WSGIRequest' object has no attribute '_request'
Curious if anyone else has attempted to use DRF token authentication and session authentication such that the GraphiQL UI is available to logged in users.