-
First off, thanks for graphene-django! Question: how does graphene-django work with Django's session authentication? For a number of reasons I need to move away from JWT authentication (which was working fine). I implemented a login mutation as follows.
I see that a fresh I presumably need to set some In other words, what is the equivalent of I see some previous discussions that come close (for example, #476). However, none seem to answer this question directly. Some other relevant settings:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I took a stab at this myself, partly inspired and stolen from other similar libraries. A proof of concept implementation would look as follows. I'm pretty sure there are still problems all over the place, but it seems to correctly set First add
Then
And, as a bonus,
|
Beta Was this translation helpful? Give feedback.
I took a stab at this myself, partly inspired and stolen from other similar libraries.
A proof of concept implementation would look as follows. I'm pretty sure there are still problems all over the place, but it seems to correctly set
request.user
based on the configuredAUTHENTICATION_BACKENDS
, which in the case ofdjango.contrib.auth.backends.ModelBackend
means usingsessionid
in theCookie
header.First add
MIDDLEWARE
toGRAPHENE
, to point at the class that implements the middleware. In this case, that'sbmt.auth.middleware.AuthenticationMiddleware
.Then
bmt/auth/middleware.py
would look like…