Add a Google IdP
On this page
Add a Login with Google button to the FusionAuth login page. This guide shows how to collect the credentials from Google and configure the Google Identity Provider, a Social loginLogin through an account the user already has with a consumer service, such as Google or Apple. option.
After you configure the Identity Provider, you can enable the Google login button for one or more FusionAuth Applications. The following login page shows the Google Identity Provider:

The following diagram shows a login through Google on the FusionAuth hosted login pages:
A user logs in through an Identity Provider on the FusionAuth hosted login pages.
The user sees only the FusionAuth login page, the login page of Google, and your application. Your application completes a standard OAuth authorization code grant with FusionAuth, and FusionAuth handles the exchange with Google.
Create Google OAuth Client Credentials#
Google manages OAuth clients in the Google Auth Platform section of the Google Cloud console. To find the section, search for Google Auth Platform in the console search bar.
-
Log in to the Google Cloud console with a Google account. Select a project, or create a project.
-
Navigate to Google Auth Platform -> Overview . When the project has no OAuth configuration, click Get started . Fill in the following sections, then finish the setup:
- App Information: the App name and User support email that users see on the Google consent screen.
- Audience: usually
External, which lets any Google account log in.Internallimits login to the users in your Google Cloud organization. - Contact Information: the email addresses that receive notifications from Google about the project.
-
Navigate to Google Auth Platform -> Audience . While the Publishing status is
Testing, only the test users can log in with Google. Under Test users, click Add users and add the Google accounts that you test with. To let any Google account log in, publish the app. For more information, see Additional Steps for Your Google Application. -
Navigate to Google Auth Platform -> Data Access . Click Add or remove scopes . Most applications select
openid,https://www.googleapis.com/auth/userinfo.email, andhttps://www.googleapis.com/auth/userinfo.profile. Click Update , then click Save at the bottom of the page. Google discards the scopes when you leave the page without saving.Some scopes need more configuration in the Google console. For more information, see the full list of Google scopes. Use the same scopes later in the Scope field of the FusionAuth Identity Provider.
-
Navigate to Google Auth Platform -> Clients . Click Create client .
-
Set Application type to
Web application, and fill in Name. Google shows the name only in the console. -
Configure the client for your login method. The example uses
https://login.piedpiper.com, the FusionAuth URL for Pied Piper.- When you use the redirect method, add the FusionAuth callback URL to Authorized redirect URIs. For FusionAuth at
login.piedpiper.com, the value ishttps://login.piedpiper.com/oauth2/callback. When the URI doesn't match the FusionAuth callback URL exactly, Google returns aredirect_uri_mismatcherror. Google requires HTTPS for every host exceptlocalhost. - When you use the popup method, add the origin of your login page to Authorized JavaScript origins.
- When you use the redirect method, add the FusionAuth callback URL to Authorized redirect URIs. For FusionAuth at
-
Click Create . Google shows the Client ID and the Client secret.
CautionGoogle shows the full client secret only when you create the client. Copy the Client ID and the Client secret before you close the dialog. After you close the dialog, the console shows only the last four characters of the secret. To get a new secret, open the client and click Add secret .
Create a Google Identity Provider#
Create the Google Identity Provider in FusionAuth. Fill in Client Id and Client secret with the values from the Google Cloud console. Set Scope to the scopes that you configured in the Google console. Button text is required and defaults to Login with Google.
To enable Google for an Application or CIMD domain:
-
In the Admin UI, navigate to Settings -> Identity Providers .
-
Click the arrow next to the add button, and select Google .
-
Select the Tenant for the Identity Provider, or select
Global identity provider. You can't change the scope later. For more information, see Identity Provider Scope. -
Fill out the form. Your identity provider supplies most of the values. For a description of each field, see Form Fields.
-
On the Applications tab, turn on Enabled for each Application or CIMD domain that uses the Identity Provider.
-
To register new users for the Application with the Application's default roles, turn on Create registration. When Create registration is off, a user needs a registration for the Application before the user can log in through the Identity Provider.
-
Click .
The login page of each enabled Application then shows a login button for the Identity Provider. An Identity Provider with managed domains asks for the user's email address instead of showing a button.

Form Fields#
IdAn optional UUID. When you leave out the Id, FusionAuth generates a unique Id.
TenantThe Tenant that this Identity Provider belongs to. The field appears only when you select a specific Tenant on the previous page. When you select Global identity provider on the previous page, the field doesn't appear.
NameA unique name for the Identity Provider. FusionAuth uses the name for display only, and you can change the name later.
Client IdThe Client ID from the Google credentials settings.
Client secretThe Client secret from the Google credentials settings.
Login MethodWhat happens after the user clicks the Identity Provider button, such as Login with Google:
Use redirect for login: FusionAuth redirects the user to a Google login page. After the user authenticates, Google redirects the user back to FusionAuth. Set the redirect URL to an absolute URL in the Google console for your application. For a hostname oflogin.piedpiper.com, the redirect URL ishttps://login.piedpiper.com/oauth2/callback.Use popup for login: FusionAuth opens a popup where the user logs in with Google. After the user authenticates, the popup closes. Allow your hostname in Authorized JavaScript origins in the Google console for your application, such ashttps://login.piedpiper.com.Use vendor JavaScript: The vendor JavaScript library decides the login method.
When the OAuth Authorize endpointThe OAuth 2.0 endpoint where a user logs in and grants an application access. In FusionAuth, the authorization endpoint is /oauth2/authorize. request includes an idp_hint, FusionAuth uses the redirect method, even when you select Use popup for login.
1.44.0Before FusionAuth 1.44.0, Use popup for login doesn't work. UseRedirect continues to work. For more information, see the 1.44.0 release notes. For a workaround and the update process, see the forum post about the Google Identity Provider changes.
Button textThe text of the button on the login form. The default value is Login with Google.
1.44.0FusionAuth uses Button text only when Login Method is Use redirect for login. Google manages the button text for the other login methods. Google allows minor adjustments through the Google API. To adjust the button, add any valid API parameter to Button properties.
ScopeThe scopes that FusionAuth requests from the user during login. Common scopes are email, profile, and openid. For more information, see the Google login documentation.
1.44.0FusionAuth uses Scope only when Login Method is Use redirect for login. FusionAuth always requests the email, profile, and openid scopes for the other login methods.
When Login Method is Use redirect for login, fill in Scope. Google requires the scope parameter, and FusionAuth sends no scope parameter when Scope is empty. Google then rejects the login request.
Linking strategyHow FusionAuth links a Google user to a FusionAuth user. For more information, see Linking Strategies.
Available since 1.65.0 You can only change this value when the identity provider is disabled. To change the linking strategy for an identity provider that is already enabled, disable the provider, change the value, and then re-enable the provider.
Reconcile lambdaA lambda that maps custom claims from Google to the user.
To create a lambda, navigate to Customizations -> Lambdas .
Enable debug loggingCreates Event Log entries that help you debug integration errors. To read the entries, navigate to System -> Event Log .
Tenants#
The Tenants tab limits the number of links that each user in a Tenant can have to this Identity Provider. Links to other Identity Providers don't count toward the limit. On a global Identity Provider, the tab starts empty. To set a limit for a Tenant, click Add tenant configuration . On a tenant-scoped Identity Provider, the tab lists only the Identity Provider's Tenant.
Limit links per userWhen turned on, FusionAuth enforces Maximum link count for users in the Tenant.
Maximum link countThe maximum number of links that a user can have to this Identity Provider. When a user reaches the limit, FusionAuth rejects a new link. The Link API returns a 400, and the hosted login pages show an error.
For more information, see Identity Providers and Tenants.
Options#
The Options tab sets properties for the Google Identity Services API.
FusionAuth applies API properties and Button properties only when the login uses the Google Identity Services (GIS) API. When Login Method is Use redirect for login, FusionAuth doesn't use the GIS API or the properties. To style the button in that case, use Themes.

Form Fields#
API propertiesThe Google Identity Services login API configuration, as a string in properties file format. You can add any attribute from the Google Identity Services HTML reference. Templates that support Google login can reference the properties to initialize the API with HTML or JavaScript. Leave the data- prefix off the property names.
When you leave out the value, FusionAuth uses the following properties:
auto_prompt=true
auto_select=false
cancel_on_tap_outside=false
context=signin
itp_support=true
Button propertiesThe Google Identity Services button configuration, as a string in properties file format. You can add any attribute from the Google Identity Services HTML reference. Templates that support Google login can reference the properties to render the login button with HTML or JavaScript. Leave the data- prefix off the property names.
When you leave out the value, FusionAuth uses the following properties:
logo_alignment=left
shape=rectangular
size=large
text=signin_with
theme=outline
type=standard
Google One Tap#
Google One Tap lets a user register or log in with a single action on applications that support One Tap.

To turn on Google One Tap in FusionAuth 1.44.0 and later:
- Set Login Method to
Use popup for login. - Add
auto_prompt=trueto API properties.
Additional Steps for Your Google Application#
The earlier steps are enough for development and personal applications. For other applications, publish your OAuth application with Google.
When a production application requests sensitive scopes, verify your application with Google.
Building Your Own Integration#
To build your own login experience instead of using the FusionAuth hosted login pages, start the Identity Provider flow in your application, and complete the login with the Login API. The following diagram shows the flow:
Your application starts the Identity Provider login and completes the login with the FusionAuth API.
For the request that completes the login, see the Google Identity Provider API.
When your application needs a refresh token after the login, turn on Enable JWT Refresh for the Application. In the Admin UI, navigate to Applications -> Your Application -> Security -> Login API settings .
Custom Parameters#
Some Google functionality needs custom URL parameters when the login starts. Examples include the following parameters:
access_type=offlinereturns a refresh tokenA credential that an application exchanges for a new access token without asking the user to log in again. from Google. Google returns the refresh token only the first time the user consents. To get a refresh token on every login, also addprompt=consent. For more information, see the Google offline access documentation.prompt=select_accountforces an account selection screen.
For more parameters, see the Google OpenID Connect advanced topics.
The Google Identity Provider doesn't support custom parameters. Google conforms to OIDC, so an OpenID Connect Identity Provider gives the same functionality with a little more configuration. To use custom parameters:
- Create an OpenID Connect Identity Provider.
- Set Discover endpoints to
false. - Enter the endpoints from the Google Discovery document.
- Add the space-separated Google OAuth2 scopes to Scope. The most common scopes are
openid,profile, andemail. When you use the linking on email strategy, includeemail. - Append the parameters to the Authorization endpoint value, such as
https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&prompt=select_account.
Limitations#
The Google Identity Services (GIS) client supports one configuration per page. FusionAuth therefore can't show more than one GIS configuration on the same login page.
A Google Identity Provider with a Login Method of Use popup for login or Use vendor JavaScript uses the GIS client. The GIS client gives a more dynamic user experience and supports Google One Tap.
When more than one Google Identity Provider that uses the GIS client is available on the same login page, the themed page initializes the button for one configuration. The other GIS Identity Providers show no button.
To work around the limitation, use one of the following options:
- Enable only one Google Identity Provider that uses the GIS client for each Application.
- Set Login Method to
Use redirect for loginon the other Google Identity Providers.
Related
Learn about the APIs for creating, retrieving, updating and disabling a Google identity provider.
Learn how FusionAuth delegates login to external identity providers.
Learn how to map the data from a Google login to a FusionAuth user and registration with a reconcile lambda.
Learn about the APIs for creating, retrieving, updating and disabling an Apple identity provider.