Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to login with newly created user in keycloak

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%3A%2F%2Flocalhost%3A8080%2Fadmin%2Fmaster%2Fconsole%2F%23%2Fmyrealm%2Fusers%2F9d6a5677-3767-4bce-a5bb-db20fe2c7ac5%2Fsessions#/, 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?

like image 699
Harsh Avatar asked Oct 16 '25 04:10

Harsh


1 Answers

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/

like image 180
sonOfRa Avatar answered Oct 17 '25 21:10

sonOfRa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!