Skip to content

User is disabled error #332

@IliasVilux

Description

@IliasVilux

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions