-
Notifications
You must be signed in to change notification settings - Fork 107
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
Mutation register errors "Please, enter valid credentials" #126
Comments
I have the exact same problem. |
Same. Not sure what's going wrong here. |
I have the exact issue.
I fixed it by setting in my settings.py file
|
There is some confusion caused by the AUTHENTICATION_BACKENDS setup instructions from the documentation, which when not set properly, it will cause confusing errors to appear which are not related to the error source. Example of such confusion: - PedroBern#126
Circling back, can confirm that the above missing config was the issue for me too. |
I can also confirm that this solved my issue which was the same. |
Thanks vladcalin - adding 'django.contrib.auth.backends.ModelBackend' worked. |
Hi Working with django graphql auth following the tutorial encountered the same problem, but im working with Django4.0, from the start django-graphql-auth throws a coupple of errors, first:
but now when i try to use the class from graphql_auth import mutations.Register to extend another one to pass an argument to register by default using an identification number, it throws:
|
manage to fix the issue
#... |
Prerequisites
For more information, see the CONTRIBUTING guide.
Description
Hi,
I am using django-graphql-auth. I have followed quickstart guide on https://django-graphql-auth.readthedocs.io/en/latest/quickstart/. I have only imlemented the registration of a user. But it seems like I can't create one. I receive a message "Please, enter valid credentials"
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.
settings.py file
`
INSTALLED_APPS = [
]
AUTH_USER_MODEL = "core.Users"
GRAPHENE = {
"SCHEMA": "config.schema.schema",
'MIDDLEWARE': [
'graphql_jwt.middleware.JSONWebTokenMiddleware',
],
}
AUTHENTICATION_BACKENDS = [
"graphql_jwt.backends.JSONWebTokenBackend",
"graphql_auth.backends.GraphQLAuthBackend",
]
GRAPHQL_JWT = {
"JWT_VERIFY_EXPIRATION": True,
'JWT_LONG_RUNNING_REFRESH_TOKEN': True,
"JWT_ALLOW_ANY_CLASSES": [
"graphql_auth.mutations.Register",
],
}
`
my usermanagement apps
mutations file
`
import graphene
from graphql_auth import mutations
class AuthMutation(graphene.ObjectType):
register = mutations.Register.Field()
class Mutation(AuthMutation, graphene.ObjectType):
pass
`
queries file
`
from graphql_auth.schema import UserQuery, MeQuery
from .schema import *
import graphene
class Query(UserQuery, MeQuery, graphene.ObjectType):
pass
`
schema file
#Nothing in
In my config project
my schema file
`from core.models import *
from graphene_django import DjangoObjectType
import graphene
from usermanagement.queries import Query as auth_query
from usermanagement.mutations import Mutation as auth_mutation
class Query(auth_query, graphene.ObjectType):
pass
class Mutation(auth_mutation,graphene.ObjectType):
pass
schema = graphene.Schema(query= Query, mutation=Mutation)`
Expected behavior
The query
mutation { register( email: "[email protected]", username: "new_user", password1: "supersecretpassword", password2: "supersecretpassword", ) { success, errors, token, refreshToken } }
The Response
{ "data": { "register": { "success": true, "errors": null, "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VybmFtZSI6Im5ld191c2VyMjIiLCJleHAiOjE1ODAxMzUyMTQsIm9yaWdJYXQiOjE1ODAxMzQ5MTR9.lzMjYo_1LO-TMDotySi1VHoC5yLyKr5PWC2l-hdzQ20", "refreshToken": "8db1c55b8dbc1f4a24eabe6f5d44dc091a8ca0f7" } } }
Actual behavior
The query
mutation {
register(
email: "[email protected]",
username: "new_user",
password1: "supersecretpassword",
password2: "supersecretpassword",
) {
success,
errors,
token,
refreshToken
}
}
The Response
{
"errors": [
{
"message": "Please, enter valid credentials",
"locations": [
{
"line": 3,
"column": 3
}
],
"path": [
"register"
]
}
],
"data": {
"register": null
}
}
Requirements
aniso8601==7.0.0
asgiref==3.4.1
certifi==2021.5.30
cffi==1.14.6
charset-normalizer==2.0.6
coreapi==2.3.3
coreschema==0.0.4
cryptography==3.4.8
defusedxml==0.7.1
Django==3.2.7
django-filter==21.1
django-graphql-auth==0.3.16
django-graphql-jwt==0.3.0
django-templated-mail==1.1.1
djangorestframework==3.12.4
djangorestframework-simplejwt==4.8.0
djoser==2.1.0
graphene==2.1.9
graphene-django==2.15.0
graphql-core==2.3.2
graphql-relay==2.0.1
idna==3.2
importlib-metadata==1.7.0
itypes==1.2.0
Jinja2==3.0.1
MarkupSafe==2.0.1
oauthlib==3.1.1
promise==2.3
psycopg2-binary==2.9.1
pycparser==2.20
PyJWT==1.7.1
python3-openid==3.2.0
pytz==2021.1
requests==2.26.0
requests-oauthlib==1.3.0
Rx==1.6.1
singledispatch==3.7.0
six==1.16.0
social-auth-app-django==4.0.0
social-auth-core==4.1.0
sqlparse==0.4.2
text-unidecode==1.3
typing-extensions==3.10.0.2
uritemplate==3.0.1
urllib3==1.26.7
zipp==3.5.0
The text was updated successfully, but these errors were encountered: