Questions tagged [django-graphql-jwt]

This tag is for the implementation of django-graphql-jwt which is a

JSON Web Token authentication for Graphene-Django

28 questions
14
votes
1 answer

Graphene-Django and many to many relationship lookup

I have two Django models - Teacher and Student and have a many-to-many relationship. Teachers can have multiple students and students can have multiple teachers. There is 'through' model called 'Remarks' where a teacher can mark a student as…
8
votes
3 answers

Django GraphQL JWT: tokenAuth mutation returns "str object has no attribute decode"

Currently I'm running a basic example of django-graphqljwt from the documentation page. https://django-graphql-jwt.domake.io/en/latest/quickstart.html import graphene import graphql_jwt class Mutation(graphene.ObjectType): token_auth =…
Dipanshu Juneja
  • 1,204
  • 14
  • 29
3
votes
1 answer

Apollo client subscription pass JWT token handled by Django Channels middleware

I use Graphql subscriptions with Apollo client on a Vue3 app using Django graphQL Channels and DjangoGraphqlJWT packages in my backend app. I'm trying to pass a JWT token on the Apollo subscriptions via the connectionParams. Following this solution.…
Brieuc
  • 3,994
  • 9
  • 37
  • 70
3
votes
1 answer

how to use custom user model for django-graphql-auth

I am using graphql in my project and want to generate token while registration. Even though django-graphql-auth has all the written mutation, it uses a different user model. But I want to use my custom user model. What should I do? This is my user…
Booshra
  • 63
  • 7
2
votes
1 answer

What are the default expiry time for Access Token and Refresh Token? (Django GraphQL JWT)

I use Django GraphQL JWT. Then, I could set the expiry time for Access Token and Refresh Token in "settings.py" as shown below: # "settings.py" from datetime import timedelta GRAPHQL_JWT = { "JWT_VERIFY_EXPIRATION": True, …
2
votes
1 answer

How to solve 'NoneType' object has no attribute 'fields' in Graphene-django

Have this mutation class AddStudentMutation(graphene.Mutation): class Arguments: input = StudentInputType() student = graphene.Field(StudentType) @classmethod @staff_member_required def mutate(cls, root, info,…
K.Nehe
  • 424
  • 10
  • 22
2
votes
1 answer

"Error: Error decoding signature" and "Variable '$token' is never used in operation 'VerifyToken'."

Tools: Django + Next.js + Django-GraphQL-JWT What works: I can login the user and obtain a JWT token, which I save in addition to saving the token in the localStorage to retrieve and verify later. What does not work: I can successfully retrieve the…
Dr J
  • 135
  • 11
2
votes
1 answer

django-graphql-jwt with django-phone-field Object of type PhoneNumber is not JSON serializable

I'm currently using the django-phone-field library in a project where I use graphene-django as well. Here's my custom User model, where I'm using the PhoneField. class User(AbstractBaseUser, PermissionsMixin): """ Custom User model to add…
2
votes
1 answer

module 'jwt' has no attribute 'ExpiredSignature'

I have been developing a Django application using graphene/graphql running over AWS using Docker alpine image. I have been using django-grapql-jwt-0.3.1 module for calling jwt-2.0.0 authentication in my application. Where it is calling…
2
votes
0 answers

How can we add authorization for graphql api in Django graphene?

I am using React Native as client and Django Graphene at Backend.Also i am using django-graphql-auth for login. I am getting token and refresh token from tokenAuth mutation. But currently if anyone knows my mutation or query along with graphql end…
2
votes
1 answer

How to authenticate with django-grahql-jwt in a graphene-django GraphQLTestCase?

I'm trying to test my mutation according to graphene django documentation. the mutation works with @login_required decorator and there's a problem because any method of login to test doesn't work. I tried with self.client.login,…
Sevy
  • 93
  • 10
1
vote
1 answer

How to integrate Facebook Login in django-graphql-jwt?

We have a django project that uses the Graphene-Django library to implement a GraphQL API in our project. This backend is accessed by our mobile apps. For the authentication of the apps, we use the django-graphql-jwt library, which is a JSON Web…
1
vote
1 answer

How to configure the JWT token in django-graphql-jwt to obtain the userId in the token instead of just the username?

TLDR - But by default the JWT token sent from the backend only includes the username. I want the userId as well.This is what it contains currently:- HEADER:ALGORITHM & TOKEN TYPE { "typ": "JWT", "alg": "HS256" } PAYLOAD:DATA { "username":…
Ragav Y
  • 1,662
  • 1
  • 18
  • 32
1
vote
2 answers

Django Graphql Auth not logged in user

I'm using Django Graphql Auth in my api but when I want to get the current logged in user always get the Anonymous. # settings.py MIDDLEWARE = [ # ... 'django.contrib.auth.middleware.AuthenticationMiddleware', # ... ] AUTH_USER_MODEL =…
1
vote
0 answers

Handling Authentication in NuxtJs store GraphQL Apollo Client

I use django/django-graphql-auth and now am trying to understand NuxtJs authentication strategies when reaching user by Apollo client from a vuex store module. I have followed lots of documentations and all the examples are about query in GraphiQL…
ytsejam
  • 3,291
  • 7
  • 39
  • 69
1
2