Add Google Login
# Add Google Login
You can add Google login to your applications using Asgardeo and enable users to log in with their Google account.
Follow this guide for instructions.
# Register Asgardeo on Google
You need to register Asgardeo as an OAuth2.0 application on Google.
You can follow the Google documentation (opens new window) for detailed instructions.
Go to the Google Developer console (opens new window), create a new project or select an existing project.
If the APIs & services page isn't already open, do the following:
Open the navigation menu and click View all products.
Under Management, click APIs & Services.
Go to the Credentials page, click Create Credentials, and select Oauth client ID.
Configure your consent screen by clicking Configure Consent Screen and return to Create OAuth client ID screen once you are done.
For more information, see User Consent (opens new window)
Select the Web application as the application type.
Provide a name for your app and the following URL as the Authorized Redirect URI of the application:
https://api.asgardeo.io/t/{organization_name}/commonauth
1Take note of the client ID and client secret generated for the application.
# Register the Google IdP
Now, let's register the Google IdP in Asgardeo.
On the Asgardeo console, go to Develop > Connections.
Click New Connections and select Google.
Enter the following details of the Google identity provider and click Finish:
Parameter Description Name A unique name for this Google identity provider. Client ID The client ID obtained from Google. Client secret The client secret obtained from Google.
Claim syncing for JIT-provisioned users
JIT user provisioning is enabled by default for your external identity provider. If required, you can disable JIT user provisioning.
When a user with a local Asgardeo account uses the same email address to log in through an external identity provider, Asgardeo syncs the claims from the JIT-provisioned user account and the local account.
According to the default behavior of Asgardeo, when JIT user provisioning is enabled, the user claims of the local user account are overridden by the user claims received from the external identity provider.
You can use Asgardeo's identity provider APIs to configure claim syncing between the external identity provider and the local user accounts. This gives you the flexibility to customize the claim syncing behavior according to your specific requirements.
After the Google identity provider is created, go to the Settings tab and see the list of scopes to which Google has granted permissions.
- email: Allows to view the user's email address.
- openid: Allows authentication using OpenID Connect and to obtain the ID token.
- profile: Allows to view the user's basic profile data.
Asgardeo needs these scopes to get user information. Asgardeo checks the attribute configurations of the application and sends the relevant attributes received from Google to the app. You can read the Google documentation (opens new window) to learn more.
# Enable Google login
Before you begin
You need to register an application with Asgardeo. You can register your own application or use one of the sample applications provided.
On the Asgardeo console, go to Develop > Applications.
Open your application from the list and go to the Sign-in Method tab.
If you haven't already defined a sign-in flow, click Start with Default configuration to get started.
Click Add Authentication on the step, select your Google identity provider, and click Add.
# Try it out
Follow the steps given below.
Access the application URL.
Click Login to open the Asgardeo login page.
On the Asgardeo login page, Sign in with Google.
Log in to Google with an existing user account.
When a user successfully logs in with Google for the first time, a user account is created in the Asgardeo console with the Google username. This new user account will be managed by Google.
# Delete a connection
Before you begin
If your connection has applications associated with it, you will not be able to delete the connection.
Before deleting such connections:
- Check the associated applications from the Connected Apps tab of the connection.
- Click on a listed application. You will be redirected to the Sign-in Method tab of the respective application.
- Remove the connection from the sign-in flow of the associated applications.
- Repeat steps 2 and 3 for all listed applications.
- Proceed to delete the connection.
To delete a connection that does not have any applications using it:
On the Asgardeo Console, go to Develop > Connections.
Hover your cursor over the connection you created and click on the delete icon that appears.
- You cannot delete the default connections of Asgardeo.
- You can delete only the connections made by yourself.
Select the checkbox and confirm your action.
Your connection will be successfully deleted.