Logging in to an Application Using Google¶
This tutorial guides you through configuring Google and WSO2 Identity Server (WSO2 IS) to enable users to log in to your application using their Google credentials. In this tutorial, Google is configured as a SAML2 federated identity provider (IdP) and a sample application called "Pickup" acts as the service provider. Follow the instructions in the sections below to set this up.
Before you begin
- Create a Google domain.
- Download and install Apache Tomcat version 8.*.* or higher.
- Install WSO2 IS by downloading the installer.
/etc/hostsfile, add the following entry, and restart your computer.
To avoid any IP address conflicts, ensure that this is the only entry for this IP address in the
This step is only required if you wish to use a WSO2 IS sample application to try out this scenario. If you wish to use your own application instead, you can skip this step.
Set up Google as a SAML IdP¶
- Access the Google Admin console by navigating to this URL: https://admin.google.com/.
- Log in using your administrator account.
- Click Admin Console.
Click Apps and then click SAML apps.
If you do not see the Apps button on the home page, click More Controls at the bottom of the page.
Click on the icon found at the bottom-right of the page.
Click SETUP MY OWN CUSTOM APP
Click Download next to the IDP Metadata field to download the Google identity provider metadata.
GoogleIDPMetadata.xmlfile is downloaded on to your machine.
Click Next and enter an Application Name and Description for your application. This is the name and description that your users will see.
You can also upload an image of your logo.
Click Next and enter the following details.
In this tutorial, the Start URL configured below is the homepage URL of a WSO2 IS sample application called "Pickup".
- ACS URL:
- Entity ID:
- Start URL :
- Name ID Format:
- ACS URL:
Click Next and then click Finish.
- Once the application is configured, click Edit Service and change the Service Status to ON. You can turn on the service for everyone or for some users only.
Configure Google as a SAML IdP in WSO2 IS¶
Start WSO2 Identity Server by navigating to
<IS_HOME>/bin/folder and running the following command.
Log in to the management console using admin/admin credentials.
- Click Add under Identity Providers on the Main tab.
- Enter "GoogleIdP" as the identity provider name and expand Federated Authenticators>SAML2 Web SSO Configuration.
Select Enable SAML2 Web SSO and enter "wso2is1" as the Service Provider Entity ID.
The Service Provider Entity ID value should be equal to the value you entered as the Entity ID when configuring Google.
Select Metadata File Configuration as the Mode and upload the
GoogleIDPMetadata.xml file you downloaded earlier.
Click Register to save the identity provider configurations.
Once the IdP is registered, it is listed under Identity Providers. Click Edit and expand Federated Authenticators>SAML2 Web SSO Configuration.
Select Enable Logout and enter " https://accounts.google.com/logout" as the Logout URL.
Click Update to save the changes.
Set up the sample application¶
The instructions in this section are only required if you are using the Pickup sample application to try out this scenario. Skip the instructions in this section if you are using your own application instead.
- Deploy and configure
- Edit the above configured service provider to configure Google as the federated Identity Provider. Expand Local and Outbound Configuration and select Federated Authentication.
Select "GoogleIdP" (the identity provider you created before) as the federated authenticator.
Click Update to save.
Trying it out¶
- Access the Pickup sample application URL: http://localhost.com:8080/saml2-web-app-pickup-dispatch.com
Click Login. You are redirected to the Google login page.
Sign in using your Google credentials. You are redirected to the Pickup sample homepage.
On a new tab on your browser, access the following URL: https://mail.google.com.
You are automatically logged in to your Gmail using single sign-on (SSO).
Next, logout from the Pickup application. To logout, click on your username on the top-left corner and click Logout.
- Access the Gmail tab. Note that you are logged out of Gmail using single logout.