django-keycloak
django-keycloak copied to clipboard
Help!
Having trouble with the following when I run the django admin keycloak add user command.
File "/usr/local/lib/python2.7/dist-packages/keycloak/client.py", line 82, in _handle_response
with response:
AttributeError: exit
Not sure how to get this up and running.
Hi @bssher which version do you use?
Django==1.11.16 using this project. https://github.com/GeoNode/geonode
@bssher The problem is probably the version of the requests library you are using. Older versions of the requests library are not compatible with the with response:
as used in the keycloak client (hence the error). I would suggest updating requests to the newest version which should solve your problem.
Thanks @bossan. I was able to resolve it by upgrading response.
Next question how do I access the login page. I have updated the urls.py, what is the path to navigate to? I am able to run the refresh realm django admin command and all seems populated correctly in my admin console.
If you followed the docs as you said e.g.:
# your-project/urls.py
...
urlpatterns = [
...
url(r'^keycloak/', include('django_keycloak.urls')),
]
You can find the login url at: /keycloak/login
.
The pattern is named keycloak_login
, which makes it possible to use it with Django's reverse function
Thanks for the help! I'm getting closer. When I login I get the following message in the apache logs JWTError: Signature verification failed.
My guess is its a keycloak configuration. Ideas?
Did you already refreshed the certificates using the Django Admin? It seems like a lack or a mismatch in certificates between your app and Keycloak which causes that the JWT signature cannot be validated.
I didn't. What's the command in django admin. The only 2 commands I see available are keycloak_add_user keycloak_refresh_realm
Also any specific setting you make in keycloak in the Fine Grain OpenID Connect Configuration?
In meantime I've released a new version and updated the docs. Please read the section about refreshing the certificates: https://django-keycloak.readthedocs.io/en/latest/scenario/initial_setup.html#refresh-certificates