Home > Blockchain >  Unable to login with newly created user in keycloak
Unable to login with newly created user in keycloak

Time:12-22

I am following this tutorial

https://www.keycloak.org/getting-started/getting-started-docker

I managed to bring up keycloak server using the following command

docker run -p 8080:8080 -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=admin quay.io/keycloak/keycloak:20.0.2 start-dev

on my local machine and login to console via http://localhost:8080

I am able to login using the admin user. Post that, I created a realm and a new user and set the credentials, however, I am unable to login via newly created user. (Marked it enable while creating) The error I see in docker logs is

2022-12-21 14:23:00,184 WARN  [org.keycloak.events] (executor-thread-17) type=LOGIN_ERROR, realmId=f5e9717b-0eeb-47cf-9d9b-2f697416c841, clientId=account-console, userId=null, ipAddress=172.17.0.1, error=user_not_found, auth_method=openid-connect, auth_type=code, redirect_uri=http://localhost:8080/realms/master/account/?referrer=security-admin-console&referrer_uri=http://localhost:8080/admin/master/console/#/myrealm/users/9d6a5677-3767-4bce-a5bb-db20fe2c7ac5/sessions#/, code_id=aa9ac3df-dadc-4abc-bfea-022b27ca35f0, username=harsh, authSessionParentId=aa9ac3df-dadc-4abc-bfea-022b27ca35f0, authSessionTabId=XmE45k_yHPg

I see user_not_found although it exists and I have set the credentials as well.

Is there any other configuration needed for this user to be enabled?

CodePudding user response:

It looks like you created a new realm, and created a user in that realm. The "redirect_uri" in your log entry suggests that you tried to log into the master realm's account console (http://localhost:8080/realms/master/account). Realms are separated from each other regarding users. You'll have to log into your newly created realm's account console, rather than the master realm's account console.

The issue can be fixed by changing the URL to (updating the realm as suggested)

http://localhost:8080/realms/myrealm/account/

  • Related