Graphene JWT authentication

173 views Asked by At

I'm using graphene-jwt to authenticate user but my user has to multiple object return

here

def mutate(cls, root, info, **kwargs):
    result = super().mutate(root, info, **kwargs)
...

How can I add additional query to 'filter' more like User.object.filter(user_type=3)? cause currently my code is like this

except (MultipleObjectsReturned, JSONWebTokenError) as e:
      users = models.User.objects.get(email=kwargs.get("email"), user_type_id=3)
       
      result = cls(
             user=users,
             errors=[Error()],
             account_errors=[],
             token=get_token(users))
            
     user = result.user

I do get token even my password is wrong, it should be failed when the password is wrong.

Thanks

0

There are 0 answers