Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graphql login does not return token #56

Closed
udemezue01 opened this issue Jun 30, 2020 · 7 comments
Closed

Graphql login does not return token #56

udemezue01 opened this issue Jun 30, 2020 · 7 comments

Comments

@udemezue01
Copy link

When I try to log in and it does not return a JSON Token

mutation {
tokenAuth(email: "johnzeus14@gmail.com", password: "oldskool123") {
success,
errors,
unarchiving,
token,
refreshToken,
unarchiving,

}
}

{
"data": {
"tokenAuth": {
"success": false,
"errors": {
"nonFieldErrors": [
{
"message": "Please, enter valid credentials.",
"code": "invalid_credentials"
}
]
},
"unarchiving": false,
"token": null
}
}
}

@PedroBern
Copy link
Owner

Please use the issue template.

@Instrumedley
Copy link

I got the same issue

@panosangelopoulos
Copy link
Collaborator

Hi @udemezue01 and @Instrumedley ,

please give us more details regarding the issue and modify the body of the message.

  • Are you able to authenticate your account using the Django authentication method?

@Instrumedley
Copy link

actually I solved this issue yesterday. In my situation it was a matter of this django.contrib.auth.backends.ModelBackend missing under AUTHENTICATION_BACKENDS on settings.py . Something that I think the instructions and quick guide tells you to do.

Now my issue is that I don't seem to be able to use protected queries correctly, so I posted a new question here
#109 , since I'm a bit lost regarding the correct configs to use

@panosangelopoulos
Copy link
Collaborator

Thanks for your answer @Instrumedley !

I'm closing the issue.

@gneyal
Copy link

gneyal commented Sep 8, 2022

After requesting:
mutation {
tokenAuth(email: "new_user", password: "supersecretpassword") {
success,
errors,
unarchiving,
token,
refreshToken,
unarchiving,
user {
id,
username,
}
}
}

I'm getting:
{
"data": {
"tokenAuth": {
"success": false,
"errors": {
"nonFieldErrors": [
{
"message": "Please, enter valid credentials.",
"code": "invalid_credentials"
}
]
},
"token": null,
"refreshToken": null,
"user": null
}
}
}

When I log in to the admin with these credentials everything works fine.

Help?

@gneyal
Copy link

gneyal commented Sep 8, 2022

I have a custom user class that looks like that:
class User(AbstractUser):
objects = UserManager()
REQUIRED_FIELDS = []
USERNAME_FIELD = "email"
username = None
email = models.EmailField("email address", blank=False, null=False, unique=True)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants