Search code examples
spring-bootkeycloak

Keycloak: get identity provider info


I have spring boot app and I use keycloak as auth. provider.

For my realm I have set FACEBOOK or GOOGLE as identity providers.

I wonder how can I find out what identity provider user used - NOT via keycloak admin console, BUT in runtime.


eg.:

user A - FACEBOOK

user B - FACEBOOK

user C - GOOGLE


Solution

  • You can set a "User Session Note" mapper to your client's mappers. Set the User Session Note field to: identity_provider

    Session Note Mapper

    Note: you can use identity_provider_identity in User Session Note field to get its username from to identity provider https://www.keycloak.org/docs/latest/server_admin/index.html#available-user-session-data