django-graphql-auth icon indicating copy to clipboard operation
django-graphql-auth copied to clipboard

Incompatible with django-graphql-jwt's cookie functionality

Open mcabrams opened this issue 5 years ago • 3 comments

Description

The Django GraphQL JWT package supports storing JWT tokens in cookies and this effects among other things the refreshToken mutation by no longer requiring it as an argument (since the frontend JS is intentionally unable to access the token itself). Behind the scenes JWT presumably adds middleware or modifies existing classes to extract the token from passed Cookie headers. When using this Cookie configuration, django_graphql_auth won't work properly since it requires the refreshToken to be passed as an actual graphql argument.

Steps to Reproduce

If we need to reproduce and you don't provide steps for it, it will be closed. Alternatively, you can link a repo with the code to run your issue.

  1. Go through minimal setup of django_graphql_jwt and enable cookie authentication and various settings:
  • https://django-graphql-jwt.domake.io/en/latest/authentication.html#per-cookie
  1. Install django_graphql_auth
  2. Observe impossibility of passing refreshToken to the refreshToken mutation due to client no longer being able to access and pass along refreshToken since it is stored in cookie.

Expected behavior

I would expect that when django_graphql_jwt is configured to use cookies, django_graphql_auth would adjust it's mutations accordingly to extract the JWT from cookies in same manner django_graphql_jwt does.

Actual behavior

django_graphql_jwt generates mutations that cannot be used due to refreshToken not being able to be explicitly passed as a graphql mutation argument.

Requirements

django==3.0.6
django-graphql-jwt==0.3.1
graphene-django==2.9.1
django-graphql-auth==0.3.10

mcabrams avatar May 28 '20 22:05 mcabrams

django==3.0.6 django-graphql-jwt==0.3.1 graphene-django==2.9.1 django-graphql-auth==0.3.10

Hi @mcabrams did you try with django-graphql-jwt==0.3.0? Currently, this package does not support the 0.3.1 version.

PedroBern avatar May 28 '20 23:05 PedroBern

@PedroBern Yes, this is not specific to 0.3.1, same behavior with 0.3.0

mcabrams avatar Jun 12 '20 18:06 mcabrams

Is there an update on this issue? I'm also running into this as well.

irmiller22 avatar Sep 11 '20 18:09 irmiller22