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

User is disabled error #332

Open
IliasVilux opened this issue Apr 30, 2024 · 0 comments
Open

User is disabled error #332

IliasVilux opened this issue Apr 30, 2024 · 0 comments

Comments

@IliasVilux
Copy link

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()
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

1 participant