How can I disable social login for a specific client in Keycloak?

492 views
Skip to first unread message

Watlas Rick

unread,
Feb 22, 2024, 4:59:36 AMFeb 22
to Keycloak User
I've noticed that upon enabling social login through identity providers, such as Google, the option to log in with Google appears on all login pages. However, I would like to remove this option for certain clients. Is there any way to specifically disable social login for selected clients?

Vladimir B

unread,
Feb 22, 2024, 5:08:28 AMFeb 22
to Keycloak User
Hi Sans,
  1. Open a specific client for which you want to disable social login (Client section in Keycloak Admin). Then "Settings" tab -> the "Login" section -> Disable the toggle or checkbox for the social login providers that you want to disable for this client
Do not forget to save changes 

Best regards,
Volodymyr 

Raphaël Enrici

unread,
Jun 5, 2024, 7:03:57 AMJun 5
to Keycloak User
Hi,

I have the exact same question and can't find anything related to disabling the identity provider in the Client->Settings->Login section or anywhere else.
I tested this with KC 22.0.x, 23.0.x and 24.0.5. Did I miss something? Do you have any insights?

Thanks,
Raph

Thomas Darimont

unread,
Jun 5, 2024, 9:22:23 AMJun 5
to Keycloak User
Hello,

I don't know which option Vladimir is discussing, as this is not available in the Keycloak UI. Perhaps he is using a highly customized Keycloak version...

Keycloak offers a range of flexible customization options, empowering you to hide the IdP login option for specific clients in the following ways:
- Use a generic custom theme for all of your clients based on the keycloak login theme and add a filter/conditional logic around the identity provider / social login template fragment on the server side, which hides the social login options for some clients, see: 
https://github.com/keycloak/keycloak/blob/main/themes/src/main/resources/theme/base/login/login.ftl#L90
- A simpler solution might be to include a javascript snippet in the theme that detects the used client from the URL parameters and simply hides the social login option
- Another option is to leverage Keycloak's client specific login theme feature -> just create a custom "minimal" theme that overloads the login.ftl from the keycloak/base login theme and simply remove the identity provider / social login template fragment

Cheers,
Thomas
Reply all
Reply to author
Forward
0 new messages