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…
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 =…
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.…
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…
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,
…
Have this mutation
class AddStudentMutation(graphene.Mutation):
class Arguments:
input = StudentInputType()
student = graphene.Field(StudentType)
@classmethod
@staff_member_required
def mutate(cls, root, info,…
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…
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…
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…
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…
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,…
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…
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":…
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 =…
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…