Home > Software engineering >  How to distinguish if user is logged in from a Provider or from a user in Keycloak
How to distinguish if user is logged in from a Provider or from a user in Keycloak

Time:10-31

I am integrating Keycloak into a React Application. I have successfully added Google Providers in Keycloak. Now the user can either log in with Keycloak user's credentials or from Login with Google. After login how to distinguish if a user is with React or with a Provider? And how to acquire the ID of that user so for certain activities to store that ID in the database?

CodePudding user response:

GET User's detail REST API detect which identity provider's user.

enter image description here

The federatedIdentities fields shows it

enter image description here

enter image description here

Demo this user login via google

You needs a master token in Posman.

#1 Get master token at Posman.

Detail instruction enter image description here

#4 Get regular user

GET http://localhost:8080/auth/admin/realms/my-realm/users/{user-uuid}

This user logged via regular Keycloak enter image description here

  • Related