OAuth 2.0 setup in Google
This document provides a step-by-step guide on how to create and configure an OAuth2 Client in the Google API Console for integrating Google Drive with external applications. To authorize the OAuth2 account successfully, create and configure an application corresponding to the account as shown in the workflow.
- A Google account with access to the Google API Console.
- Understanding of OAuth 2.0 authentication flow.
- Permissions to enable APIs and manage credentials.
-
Access Google API Console.
- If a project is not already created, click on your organization name on the top right corner.
- Click New project.
- Provide a meaningful name and Click Create.
-
Enable the Required API
- Click + Enable APIs and Services.
- Search for Google Drive API.
-
Click Enable.
-
Create OAuth credentials
- Navigate to Credentials in the left panel.
- Click + Create Credentials and select OAuth client ID.
-
If prompted, configure the OAuth consent screen:
- Provide Project configuration: application name and support details.
- After finished, Click Create.
- Under Application Type, select Web application.
- Provide a meaningful name for your OAuth client.
-
Configure the redirect URI and authorized JavaScript origins:
- Authorized JavaScript Origin: https://elastic.snaplogic.com
- Authorized Redirect URI: https://elastic.snaplogic.com/api/1/rest/admin/oauth2callback/googledrive
-
Click Create and note down your Client ID and Client
Secret.
-
Configure OAuth 2.0 Scopes
- Edit your newly created OAuth 2.0 Client.
- Navigate to Data Access.
- Click ADD OR REMOVE SCOPES.
- Add all required Google Drive scopes. OAuth 2.0 Scopes for Google APIs Each REST resource defined in the API reference notes the scope needed for the ressource. Google Drive API
-
Click Update.
Authorization Endpoint Configuration Settings
Use the following configuration settings for successful OAuth2 authentication:
Parameter Value scope
Required OAuth2 scopes. These must be defined in the OAuth2 Client in the Google Console (e.g., https://www.googleapis.com/auth/drive
) Learn more. Refer to OAuth 2.0 Scopes for Google Drive API to find the necessary scope for each REST resource.access_type
offline
(Ensures refresh tokens are issued for long-term access.)redirect_uri
https://elastic.snaplogic.com/api/1/rest/admin/oauth2callback/googledrive
(Specifies the callback URL for authentication.)prompt
consent
(Forces user consent during authentication, ensuring fresh permissions are granted.)Important: The defined scopes must match those configured in the Google OAuth Client in the console. -
Specify the credentials and validate the Snap account in SnapLogic
platform.
- Navigate to the Google Drive Snap of your choice.
- Configure the Google Drive OAuth2 User Account with the Client ID and Client secret from the Google API Console.
- Configure the OAuth2 authorization endpoin (https://accounts.google.com/o/oauth2/auth), and OAuth2 token endpoin (https://oauth2.googleapis.com/token).
- Select the Auto-refresh token checkbox in the account settings and click Apply.
- Click Authorize, sign in with valid Google credentials, and grant permissions. The Access and Refresh tokens are generated and encrypted in SnapLogic.
- Click Validate to confirm successful integration, then save the account for use in SnapLogic pipelines.