You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to explore Keycloak with Django but getting an issue while Migrating a user from Django Auth to Keycloak.
The command I ran on terminal is -
`url: http://localhost:8080/realms/django/protocol/openid-connect/token ,data: {'grant_type': 'client_credentials', 'client_id': 'Django-Keycloak', 'client_secret': 'Django-Keycloak', 'scope': 'realm-management openid'}
Traceback (most recent call last):
File "/home/aman/Desktop/cast-be/casting-backend/cast-ven/lib/python3.8/site-packages/keycloak/client.py", line 84, in _handle_response
response.raise_for_status()
File "/home/aman/Desktop/cast-be/casting-backend/cast-ven/lib/python3.8/site-packages/requests/models.py", line 960, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://localhost:8080/realms/django/protocol/openid-connect/token
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 22, in <module>
main()
File "manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/home/aman/Desktop/cast-be/casting-backend/cast-ven/lib/python3.8/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
utility.execute()
File "/home/aman/Desktop/cast-be/casting-backend/cast-ven/lib/python3.8/site-packages/django/core/management/__init__.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/aman/Desktop/cast-be/casting-backend/cast-ven/lib/python3.8/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/home/aman/Desktop/cast-be/casting-backend/cast-ven/lib/python3.8/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/home/aman/Desktop/cast-be/casting-backend/cast-ven/lib/python3.8/site-packages/django_keycloak/management/commands/keycloak_add_user.py", line 40, in handle
django_keycloak.services.users.add_user(client=realm.client, user=user)
File "/home/aman/Desktop/cast-be/casting-backend/cast-ven/lib/python3.8/site-packages/django_keycloak/services/users.py", line 26, in add_user
client.admin_api_client.realms.by_name(client.realm.name).users.create(
File "/home/aman/Desktop/cast-be/casting-backend/cast-ven/lib/python3.8/site-packages/keycloak/admin/users.py", line 53, in create
return self._client.post(
File "/home/aman/Desktop/cast-be/casting-backend/cast-ven/lib/python3.8/site-packages/keycloak/admin/__init__.py", line 63, in post
url=url, data=data, headers=self._add_auth_header(headers=headers)
File "/home/aman/Desktop/cast-be/casting-backend/cast-ven/lib/python3.8/site-packages/keycloak/admin/__init__.py", line 83, in _add_auth_header
token = self._token()
File "/home/aman/Desktop/cast-be/casting-backend/cast-ven/lib/python3.8/site-packages/django_keycloak/services/client.py", line 119, in get_access_token
oidc_profile = get_service_account_profile(client=client)
File "/home/aman/Desktop/cast-be/casting-backend/cast-ven/lib/python3.8/site-packages/django_keycloak/services/client.py", line 84, in get_service_account_profile
token_response, initiate_time = get_new_access_token(client=client)
File "/home/aman/Desktop/cast-be/casting-backend/cast-ven/lib/python3.8/site-packages/django_keycloak/services/client.py", line 107, in get_new_access_token
token_response = client.openid_api_client.client_credentials(scope=scope)
File "/home/aman/Desktop/cast-be/casting-backend/cast-ven/lib/python3.8/site-packages/keycloak/openid_connect.py", line 227, in client_credentials
return self._token_request(grant_type='client_credentials', **kwargs)
File "/home/aman/Desktop/cast-be/casting-backend/cast-ven/lib/python3.8/site-packages/keycloak/openid_connect.py", line 307, in _token_request
return self._realm.client.post(self.get_url('token_endpoint'),
File "/home/aman/Desktop/cast-be/casting-backend/cast-ven/lib/python3.8/site-packages/keycloak/client.py", line 62, in post
return self._handle_response(
File "/home/aman/Desktop/cast-be/casting-backend/cast-ven/lib/python3.8/site-packages/keycloak/client.py", line 89, in _handle_response
raise KeycloakClientError(original_exc=err)
keycloak.exceptions.KeycloakClientError: 400 Client Error: Bad Request for url: http://localhost:8080/realms/django/protocol/openid-connect/token
`
Thank You
The text was updated successfully, but these errors were encountered:
I am trying to explore Keycloak with Django but getting an issue while Migrating a user from Django Auth to Keycloak.
The command I ran on terminal is -
python manage.py keycloak_add_user --realm django --user jangu
below is the complete log for the above command-
`
Thank You
The text was updated successfully, but these errors were encountered: