Setting up your Google's OAuth2 Credentials

This document instructs how to get your own OAuth2 credentials to use in Google Connections with user-provided credentials.

Prerequisites

To connect your StackAI to Google services with user-provided credentials, follow these five steps:

Create a Google Cloud Console Project

Start by creating a project in Google Cloud Console. If you already have one, you can skip ahead to the next section.

  1. Log in to your Google Cloud Console with your Google account.

  2. In the top navigation bar, open the project dropdown and click New Project or go directly to the New Project page

  3. Enter a Project name and choose a Location.

  4. Click Create to generate the project.

  5. Confirm that your new project is active by checking the project dropdown in the top navigation. If it’s not selected, switch to the project you just created.

Enable the required APIs

Once your project is set up, you’ll need to enable the APIs that StackAI will use:

  1. Open your Google Cloud Console - Library, make sure you're in the correct project.

  2. In the left menu, go to APIs & Services > Library.

  3. Use the search bar to find the APIs you need. For example, if you’re connecting to Google Drive, search for and select the Google Drive API.

  4. Select ENABLE.

If this is your first time using OAuth in your Google Cloud project, you'll need to configure the OAuth consent screen:

  1. Open your Google Cloud Console - Library. Make sure you're in the correct project.

  2. From the left navigation menu, go to APIs & Services > OAuth consent screen. You’ll be redirected to the Google Auth Platform overview.

  3. On the Overview tab, click Get started to begin configuring your OAuth screen.

  4. Provide an App name and a User support email for the consent screen, then click Next.

  5. For the Audience, select Internal for user access within your organization's Google workspace or External for any user with a Google account. Refer to Google's User type documentation for more information on user types. Select Next to continue.

  6. Select the email addresses Google should use to contact you about project updates, then click Next.

  7. Review and accept Google’s User Data Policy, then click Continue and Create.

  8. In the left-hand menu, select Branding.

  9. In the Authorized domains section, select Add domain and add stack-ai.com

  10. Click Save to finalize your consent screen setup.

Create Google OAuth client credentials

Now you’ll generate the OAuth client credentials for your project:

  1. Open your Google Cloud Console. Make sure you're in the correct project.

  2. In the APIs & Services section in the left menu, select Credentials.

  3. Click + Create credentials > OAuth client ID.

  4. In the Application type dropdown, select Web application.

  5. Google will auto-generate a name. Update it to something meaningful so you can easily recognize it later.

  6. In the Authorized redirect URIs field, add https://www.stack-ai.com/auth

  7. Click Create to generate the credentials.

Create the connection in StackAI

With the Google project and credentials fully configured, use them in StackAI.

  1. From Google's OAuth client created modal, copy the Client ID and Client Secret.

  2. In StackAI, select to create a connection of type "OAuth Credentials" and fill your client id and secret.

  3. You will be prompted to complete Google's authentication, and with that finished your connection is ready to use.

Troubleshooting

Google hasn't verified this app

When using OAuth authentication, you may encounter the warning: “Google hasn’t verified this app.” To resolve it:

  • If your app User Type is Internal, create OAuth credentials from the same account you want to authenticate.

  • If your app User Type is External, you can add your email to the list of testers for the app: go to the Audience page and add the email you're signing in with to the list of Test users.

If you need to use credentials generated by another account (by a developer or another third party), follow the instructions in Google Cloud documentation | Authorization errors: Google hasn't verified this app.

Google Cloud app becoming unauthorized

For Google Cloud apps with Publishing status set to Testing and User type set to External, consent and tokens expire after seven days. Refer to Google Cloud Platform Console Help | Setting up your OAuth consent screen for more information. To resolve this, select Reconnect in StackAI's connections dashboard in your desired connection, and set new credentials for it.

Last updated

Was this helpful?