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

KeycloakOpenIDConnection 404 error #522

Open
yingfeic opened this issue Feb 12, 2024 · 1 comment
Open

KeycloakOpenIDConnection 404 error #522

yingfeic opened this issue Feb 12, 2024 · 1 comment

Comments

@yingfeic
Copy link

Hi,
I got a 404 error when trying to connect keycloak. I can ping the keycloak ip successfully from my machine. And the keycloak admin interface works (http://:9080/auth). Suggestions are highly appreciated.

Thank you so much for your help!

=====
from keycloak import KeycloakAdmin
from keycloak import KeycloakOpenIDConnection

keycloak_connection = KeycloakOpenIDConnection(
server_url="http://:9080/auth/",
username='admin',
password=password,
realm_name="cbioportal",
user_realm_name="admin",
client_id="account",
client_secret_key="f542.....617e",
verify=True)

Error message:
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.8/site-packages/keycloak/openid_connection.py", line 119, in init
self.get_token()
File "/usr/local/lib/python3.8/site-packages/keycloak/openid_connection.py", line 320, in get_token
self.token = self.keycloak_openid.token(
File "/usr/local/lib/python3.8/site-packages/keycloak/keycloak_openid.py", line 319, in token
return raise_error_from_response(data_raw, KeycloakPostError)
File "/usr/local/lib/python3.8/site-packages/keycloak/exceptions.py", line 192, in raise_error_from_response
raise error(
keycloak.exceptions.KeycloakPostError: 404: b''

@ShavaShav
Copy link

ShavaShav commented Feb 12, 2024

Having the same issue.

Edit: This was the issue for me: #149
If the keycloak url ends in /auth, then you need to append a trailing / (e.g. http://:9080/auth/ instead of http://:9080/auth)

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

2 participants