Enable Google Login by Adding Google as an Identity Provider in Keycloak

You can easily allow users to log in to your Keycloak realm using their Google accounts. This guide walks you through setting up the consent screen, creating a client in the Google Auth Platform, and configuring Keycloak to accept Google login


Prerequisites

  • Keycloak instance:
    https://keycloak.maksonlee.com
  • Realm name: maksonlee.com
  • A Gmail account (e.g., yourname@gmail.com)
  • A Google Cloud project (e.g., maksonlee)

  1. Enable the People API

Visit: https://console.cloud.google.com/apis/library

  1. Search for People API
  2. Click Enable

  1. Configure the Google Consent Screen

Go to: https://console.cloud.google.com/apis/credentials/consent

  1. App Information
    • App name: Keycloak Login
    • User support email: yourname@gmail.com
  2. Audience
    • Select External
  3. Contact Information
    • Developer contact email: yourname@gmail.com
  4. Finish
    • Check: “I agree to the Google API Services: User Data Policy”
    • Click Continue, then Create

  1. Create a Client in Google Auth Platform

Go to: https://console.cloud.google.com/auth/clients

  1. Click Create client
  2. Fill out:
    • Application type: Web application
    • Name: Keycloak OAuth
  3. Under Authorized redirect URIs, add: rubyCopyEdithttps://keycloak.maksonlee.com/realms/maksonlee.com/broker/google/endpoint
  4. Click Create
  5. Copy the Client ID and Client Secret

  1. Add Google as an Identity Provider in Keycloak
  • Log in to: https://keycloak.maksonlee.com/admin
  • Select realm: maksonlee.com
  • Go to:
    Identity Providers → Add provider → Google
  • Enter:
    Client ID
    Client Secret
  • Click Save

  1. Test Login

Visit:

https://keycloak.maksonlee.com/realms/maksonlee.com/account

You should now see a Google login button. Log in and confirm it redirects back to your Keycloak realm with your Google account.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top