To get OAuth client ID, client secret, access token, and refresh token for Google applications
To enable IBM® App Connect to work with Google applications like Gmail and Google Sheets, you need to get an OAuth 2.0 client ID, client secret, access token, and refresh token with appropriate scopes for Google APIs.
High-level procedure
- In the Google Admin console or the Google Cloud Platform console, select or create a project
- Define a consent screen for you to use to authorise a request to get an access token and refresh token
- Get an OAuth client ID and secret
- Enable the Google APIs that you want to let IBM App Connect use with your Google data
- Get an access token and refresh token and select API scopes
The following instructions assume that you don't have a suitable OAuth client ID and client secret for a project that has the Google APIs enabled. The procedure describes how to give IBM App Connect access to a consumer Gmail account by using the Google Cloud Platform to get an OAuth client ID and client secret. The steps also describe how to use the Google Developers OAuth 2.0 Playground to get an access token and refresh token. If you do have a suitable OAuth client ID and client secret, you can use those values to get an access token and refresh token and select API scopes without having to create and configure a new project. If you have access and refresh tokens with appropriate API scopes, use them with your client ID and client secret in App Connect to create a new account for a Google application. Other methods are available to get the necessary OAuth credentials. For example, if you're a Google Workspace account holder, you can use the Google Admin Console as an alternative to the Google Cloud Platform. For more information, see Using OAuth 2.0 to Access Google APIs and Control which third-party & internal apps access Google Workspace data in the Google documentation.
Start with a project
- Open the Google Cloud Platform https://console.developers.google.com/apis/dashboard.
(Sign in with your Google account)
- From the project menu, select an existing project or create a new project, as follows.
- Click NEW PROJECT
- If displayed, agree to the terms of service for Google Cloud Platform to continue
- Enter a project name that identifies the project.
Project for IBM App Connect - Click CREATE.
Define a consent screen for you to use to authorize a request to get an access token and refresh token
Use the OAuth consent screen option to define a consent screen.
- Select the OAuth consent screen option
- If you're not a Google Workspace user, the External checkbox is selected,
so you can use your app yourself or make your app available to any user with a Google account. These
users might see an
unverified app
screen when they configure an access token and refresh token, but they can use the OAuth credentials to connect IBM App Connect to Google apps. As a Google Workspace user, you can select the Internal checkbox to make your app available to other users in your organization. In the Google Admin console, depending on your organizational structure, settings, and policies, users can create their own Client ID and Client secret. Alternatively, they might use the Google Workspace account holder's Client ID and Client secret. Those users don't see anunverified app
screen when they configure an access token and refresh token, and they can use the OAuth credentials to connect IBM App Connect to Google apps. - Click CREATE.
- Enter a name to identify the application, such as
App for IBM App Connect. - In the Authorized domains field, enter
ibm.com, then press return to add the value to your list of authorized domains. - Click Save.
Get an OAuth client ID and secret
- Click the Credentials option
- Click + CREATE CREDENTIALS
- Click OAuth client ID
- Click the Web application checkbox
- Enter a Name to help you manage OAuth for IBM App Connect;
for example:
Web client for IBM App Connect - In the Authorized redirect URIs field, enter the redirect URI for Google
API playground (you need this value later to get the access token and refresh token):
https://developers.google.com/oauthplayground, then press return to add this value to your list - Click Create
If you later want to see the Client ID and secret, or add redirect URIs for other IBM App Connect services, from the dashboard click Credentials, then click the row under OAuth 2.0 Client IDs.
Enable the Google APIs that you want to let IBM App Connect use with your Google data
- Click the Library option.
- Select a Google API that you want to use in IBM App Connect flows, then click ENABLE.
- Gmail: Gmail API
- Google Analytics: Google Analytics API
- Google Drive: Google Drive API
- Google Sheets: Google Sheets API and Google Drive API
- Google Calendar: Google Calendar API
- Google Translate: Google Translate API
- Google Contacts: Google Contacts API
- Google Chat: Google Chat API
- Google Groups: Google Groups API
- Google Tasks: Google Tasks API
- Google Gemini: Google Gemini API
The APIs that you have enabled are listed on the dashboard; for example:

Get an access token and refresh token and select API scopes
- Display the Google Developers OAuth 2.0 Playground: https://developers.google.com/oauthplayground/
- Specify your client ID and client secret:
- Click the Settings icon (on the right)
- Select the Use your own OAuth credentials checkbox
- Enter your OAuth Client ID and OAuth Client secret
- Click Close
Figure 2. Google Developers OAuth 2.0 Playground, setting your client ID and secret 
(Click image to view full size)
- In 'Step 1 Select & authorize APIs', select the scopes of APIs for each of the Google apps
that you want to use in IBM App Connect. To enable IBM App Connect to perform all events and actions, we recommend
you select from the following scope list for the Google applications that you want to use:
- For Gmail app – (Under Gmail API v1)
- https://www.googleapis.com/auth/gmail.modify
- For Google Drive app – (Under Drive API v3)
- https://www.googleapis.com/auth/drive
- For Google Sheets app – (Under Google Sheets API v4)
- https://www.googleapis.com/auth/drive
- For Google Analytics app – (Under Google Analytics API v4)
- https://www.googleapis.com/auth/analytics
- https://www.googleapis.com/auth/analytics.edit
- https://www.googleapis.com/auth/analytics.manage.users
- https://www.googleapis.com/auth/analytics.manage.users.readonly
- 'New email' event and 'Retrieve emails' action:
- https://www.googleapis.com/auth/gmail.readonly
- 'Send email' action:
- https://www.googleapis.com/auth/gmail.readonly
- https://www.googleapis.com/auth/gmail.send
- 'Delete email' action:
- https://www.googleapis.com/auth/gmail.readonly
- https://www.googleapis.com/auth/gmail.compose
Update email labels
action requires the scope https://www.googleapis.com/auth/gmail.modify, which enable IBM App Connect to perform all events and actions.
(For the minimum API scopes for Gmail, Google Analytics, Google Drive, Google Sheets, Google Calendar, Google Translate, Google Contacts, Google Chat, Google Groups, Google Tasks, and Google Gemini, see the footnote on this page.)
Figure 3. Google APIs Playground, selecting APIs 
(Click image to view full size)
- For Gmail app – (Under Gmail API v1)
- Click Authorize APIs.
- On the Choose an account window, select the Google account that you want to
use in IBM App Connect. If this displays the message 'This app
isn't verified', it is because the app that you are configuring hasn't been verified by Google. To
continue:
- Click the Advanced link, to show the option to continue
- Click the Go to link (for the OAuth consent screen that you defined earlier)
This shows dialog windows for each of the Google APIs that you selected earlier. For each dialog window, click Allow. (If you have concerns about any permissions shown, you can later go back and change the Google APIs that you selected.) After the last dialog window, the OAuth consent screen that you defined earlier is displayed (populated with the Google APIs that you have allowed.
Figure 4. Google APIs Playground, OAuth consent window 
(Click image to view full size)
- In the OAuth consent window, click Allow. (If you have concerns about any permissions shown, you can clear option checkboxes or can go back and change the Google APIs that you enabled.)
- Under
Step 2 Exchange authorization code for tokens
- Select the check box Auto-refresh the token before it expires
- Click Exchange authorization code for tokens.
{
"access_token": "ya29.Il-9B2KbXhweZamxIsHe3_rjblkc7Xh_...VyvmQlj-JgAuWsTeTw29Hl22ivqHUIdwuDVn9ixxaEGJoDkZBZAkaCss4w",
"scope": "https://www.googleapis.com/auth/analytics.manage.users.readonly https://www.googleapis.com/auth/analytics https://www.googleapis.com/auth/analytics.readonly https://www.googleapis.com/auth/gmail.modify https://www.googleapis.com/auth/analytics.manage.users https://www.googleapis.com/auth/analytics.edit https://www.googleapis.com/auth/drive",
"token_type": "Bearer",
"expires_in": 3599,
"refresh_token": "1//04g2mKH5RhxUECgYIARAAGAQSNwF-L9IreLqEqk...x5eDp6nTKBRsxCRMVW6gU9ijJnY02uQRuw"
}
Copy the token values to somewhere secure and available for you to use in IBM App Connect when you connect to Google apps.
You now have the OAuth client ID, client secret, access token, and refresh token for Google applications
In IBM App Connect, when you create a new account for a Google app, enter your client ID, client secret, access token, and refresh token; for example:

(Click image to view full size)
Minimum scopes for different Google connector operations
| Operations | Minimum scopes needed |
|---|---|
| Create email |
|
| Delete email |
|
| New email |
|
| Retrieve emails |
|
| Update email labels |
|
| Action operations | Minimum scopes needed |
|---|---|
| All operations | https://www.googleapis.com/auth/analytics |
| Operations | Minimum scopes needed |
|---|---|
| Create comment | https://www.googleapis.com/auth/drive.file |
| Retrieve comments |
|
| Retrieve all comments |
|
| Create file | https://www.googleapis.com/auth/drive.file |
| Retrieve all files |
|
| Retrieve file metadata |
|
| Download file |
|
| Create folder | https://www.googleapis.com/auth/drive.file |
| Retrieve folder |
|
| Retrieve folder items |
|
| Retrieve all folders |
|
| Generate page tokens |
|
| Create permissions | https://www.googleapis.com/auth/drive.file |
| Retrieve permissions |
|
| Create reply | https://www.googleapis.com/auth/drive.file |
| Retrieve reply |
|
| Retrieve revision |
|
| Retrieve all revisions |
|
| All above operations | https://www.googleapis.com/auth/drive |
| Action operations | Minimum scopes needed |
|---|---|
| Create row | https://www.googleapis.com/auth/drive.file |
| Retrieve Row |
|
| Create spreadsheet | https://www.googleapis.com/auth/drive.file |
| Retrieve spreadsheet |
|
| Create worksheet | https://www.googleapis.com/auth/drive.file |
| All above operations | https://www.googleapis.com/auth/drive |
| Event operations | Minimum Scopes Needed |
|---|---|
| New complete row appended |
|
| New spreadsheet |
|
| All above operations | https://www.googleapis.com/auth/drive |
| Action operations | Minimum scopes needed |
|---|---|
| All operations | https://www.googleapis.com/auth/calendar |
| Action operations | Minimum scopes needed |
|---|---|
| All operations | https://www.googleapis.com/auth/cloud-translation |
| https://www.googleapis.com/auth/cloud-platform |
| Action operations | Minimum scopes needed |
|---|---|
| All operations | https://www.googleapis.com/auth/contacts (for App Connect) |
| https://www.googleapis.com/auth/contacts.other.readonly (for App Connect in containers) |
| Action operations | Minimum scopes needed |
|---|---|
| All operations | https://www.googleapis.com/auth/chat.delete |
| https://www.googleapis.com/auth/chat.memberships | |
| https://www.googleapis.com/auth/chat.messages | |
| https://www.googleapis.com/auth/chat.spaces |
| Action operations | Minimum scopes needed |
|---|---|
| All operations Note: Only admin scope applies to the Google Groups connector.
|
https://www.googleapis.com/auth/admin.directory.group |
| Action operations | Minimum scopes needed |
|---|---|
| All operations | https://www.googleapis.com/auth/tasks |
| Action operations | Minimum scopes needed |
|---|---|
| All operations | https://www.googleapis.com/auth/generative-language |