django-keycloak
django-keycloak copied to clipboard
Django admin not working when AUTHENTICATION_BACKENDS not set properly
Under https://django-keycloak.readthedocs.io/en/latest/index.html#setup is the point
AUTHENTICATION_BACKENDS = [
...
'django_keycloak.auth.backends.KeycloakAuthorizationCodeBackend',
]
but in an "vanilla" settings file is no AUTHENTICATION_BACKENDS
so the ...
need to be replace with the default value (see https://docs.djangoproject.com/en/3.1/ref/settings/#auth): 'django.contrib.auth.backends.ModelBackend',
, so that it looks like this
AUTHENTICATION_BACKENDS = [
'django.contrib.auth.backends.ModelBackend',
'django_keycloak.auth.backends.KeycloakAuthorizationCodeBackend',
]
else the django superuser can not login to the django admin. I banged my head for 2 hours against that, so I leave a clue here for others ...
Under https://django-keycloak.readthedocs.io/en/latest/index.html#setup is the point
AUTHENTICATION_BACKENDS = [ ... 'django_keycloak.auth.backends.KeycloakAuthorizationCodeBackend', ]
but in an "vanilla" settings file is no
AUTHENTICATION_BACKENDS
so the...
need to be replace with the default value (see https://docs.djangoproject.com/en/3.1/ref/settings/#auth):'django.contrib.auth.backends.ModelBackend',
, so that it looks like thisAUTHENTICATION_BACKENDS = [ 'django.contrib.auth.backends.ModelBackend', 'django_keycloak.auth.backends.KeycloakAuthorizationCodeBackend', ]
else the django superuser can not login to the django admin. I banged my head for 2 hours against that, so I leave a clue here for others ...
Thank you very much.
Under https://django-keycloak.readthedocs.io/en/latest/index.html#setup is the point
AUTHENTICATION_BACKENDS = [ ... 'django_keycloak.auth.backends.KeycloakAuthorizationCodeBackend', ]
but in an "vanilla" settings file is no
AUTHENTICATION_BACKENDS
so the...
need to be replace with the default value (see https://docs.djangoproject.com/en/3.1/ref/settings/#auth):'django.contrib.auth.backends.ModelBackend',
, so that it looks like thisAUTHENTICATION_BACKENDS = [ 'django.contrib.auth.backends.ModelBackend', 'django_keycloak.auth.backends.KeycloakAuthorizationCodeBackend', ]
else the django superuser can not login to the django admin. I banged my head for 2 hours against that, so I leave a clue here for others ...
Thanks, this was helpful