User is disabled error
IliasVilux opened this issue · comments
I use django with graphene and django-auth-ldap. When i run a query or mutation that has @login_required with https headers token i get this:
{
"errors": [
{
"message": "User is disabled",
"locations": [
{
"line": 2,
"column": 2
}
],
"path": [
"colaboradores"
]
}
],
"data": {
"colaboradores": null
}
}
settings.py
MIDDLEWARE = [
...
"django.contrib.auth.middleware.AuthenticationMiddleware",
...
]
GRAPHENE = {
"SCHEMA": "core.schema.schema",
"MIDDLEWARE": [
"graphql_jwt.middleware.JSONWebTokenMiddleware",
],
}
AUTHENTICATION_BACKENDS = [
"graphql_jwt.backends.JSONWebTokenBackend",
"django_auth_ldap.backend.LDAPBackend",
"django.contrib.auth.backends.ModelBackend",
]
schema.py
class Mutation(
mutationColaboradores,
mutationEstaciones,
mutationEstacionesColaboradores,
graphene.Mutation,
):
token_auth = graphql_jwt.ObtainJSONWebToken.Field()
verify_token = graphql_jwt.Verify.Field()
refresh_token = graphql_jwt.Refresh.Field()
def mutate(self):
return ""
schemaColaborador.py
class Query(graphene.ObjectType):
colaboradores = graphene.List(ColaboradorType)
@login_required
def resolve_colaboradores(self, info):
return Colaborador.objects.all()