How to Set Up Google Sheets Custom Authentication in FlowMattic


Step-by-Step Guide to Set Up Google Console Project for Google Sheets and Drive APIs

This guide walks you through creating a Google Cloud project, enabling the required APIs, obtaining the Client ID and Client Secret, and configuring test users to successfully authenticate with Google Sheets and Drive APIs.


Step 1: Create a Google Cloud Project

  1. Open your browser and go to the Google Cloud Console.
  2. Log in with your Google account.
  3. Click on the Select a project dropdown at the top of the page, then click on New Project.
  4. Provide the following details:
    • Project Name: Enter a meaningful name (e.g., “Google Sheets API Integration”).
    • Location: Leave it as “No organization” if you do not have an organization.
  5. Click Create. Google will redirect you to the project dashboard.

Step 2: Enable Google Sheets and Drive APIs

  1. While in your project dashboard, click the Navigation Menu (three horizontal lines in the top-left corner).
  2. Select APIs & Services > Library.
  3. In the API Library:
    • Search for Google Sheets API, click on it, and then click Enable.
    • Search for Google Drive API, click on it, and then click Enable.

Step 3: Configure the OAuth Consent Screen

  1. Go to APIs & Services > OAuth consent screen.
  2. Choose External as the user type and click Create.
  3. Fill out the following details:
    • App Name: Enter a meaningful name (e.g., “FlowMattic Google Integration”).
    • User Support Email: Enter your email address.
    • App Logo: Optional, but you can upload a logo if desired.
    • Authorized Domains: Add the following domain: flowmattic.com
    • Developer Contact Information: Enter your email address.
  4. Click Save and Continue.

Step 4: Add Scopes

  1. On the “Scopes” screen:
    • Click Add or Remove Scopes.
    • Select the following scopes from the list or manually add them:
      • https://www.googleapis.com/auth/spreadsheets
      • https://www.googleapis.com/auth/drive
  2. Click Update and then Save and Continue.

Step 5: Add Test Users

  1. On the “Test Users” screen:
    • Click Add Users.
    • Enter the email addresses of the Google accounts you will use to test the integration (e.g., your own or any users who will authenticate the connection).
    • You can add multiple email addresses, separated by commas or one per line.
  2. Click Save and Continue.

Important: Only users added here will be able to authenticate successfully. If you skip this step, Google will throw an error during authentication.


Step 6: Create OAuth 2.0 Credentials

  1. Go to APIs & Services > Credentials.
  2. Click on + Create Credentials and select OAuth Client ID.
  3. On the Create OAuth Client ID screen:
    • Application Type: Select Web Application.
    • Name: Enter a name for the credential (e.g., “Google Sheets OAuth”).
    • Authorized Redirect URIs: Add the following callback URL: https://api.flowmattic.com/oauth2/callback
  4. Click Create. Google will display your Client ID and Client Secret. Save these credentials securely.

Step 7: Configure FlowMattic Connect

  1. Go to the FlowMattic Connects form in your FlowMattic admin page.
  2. Click Connect New API button
  3. Fill in the following details:
    • Connect Name: Enter a meaningful name (e.g., “Google Sheets – Custom”).
    • Authentication Type: Select OAuth 2.0.
    • Callback URL: Use https://api.flowmattic.com/oauth2/callback.
    • Auth URL: Use https://accounts.google.com/o/oauth2/v2/auth.
    • Access Token URL: Use https://oauth2.googleapis.com/token.
    • Client ID: Paste the Client ID from Google Cloud Console.
    • Client Secret: Paste the Client Secret from Google Cloud Console.
    • Scopes: Enter the following (space-separated):
      https://www.googleapis.com/auth/spreadsheets https://www.googleapis.com/auth/drive
    • State: Leave blank (optional).
    • Authorization Token Name: Set to Bearer.
    • Client Authentication: Select Send as Basic Auth header.
  4. Click Save Connect & Authenticate.

Step 8: Authenticate and Generate Tokens

  1. After saving the connection, FlowMattic will redirect you to Google’s login page.
  2. Log in with one of the test user accounts you added earlier.
  3. Grant permissions for the specified scopes.
  4. Upon successful authentication, FlowMattic will store the Access Token and Refresh Token for future use in the Connect

Additional Notes

  • Token URL and Auth URL:
    • These URLs are already pre-configured as:
      • Auth URL: https://accounts.google.com/o/oauth2/v2/auth
      • Token URL: https://oauth2.googleapis.com/token
  • Token Expiry:
    • Access tokens expire after a limited time. FlowMattic will automatically renew them using the refresh token.

With this guide, you should now be able to authenticate successfully and integrate Google Sheets integration into FlowMattic without errors!

Leave a Comment

Your email address will not be published. Required fields are marked *