Skip to content

Setup Google OAuth

Alec Barber edited this page Aug 15, 2024 · 5 revisions

Introduction

Raggle integrates with Google OAuth for both authentication and as an integration for Gmail and Google docs data.

Instructions

Create a new Google OAuth application that can be used to authenticate your team and allow their Google data to be integrated into Raggle. Creating an OAuth app is free and does not require that you host the application on GCP.

  1. Create a new project in your Google Cloud account.

  2. Once initialized, configure the consent screen for users that sign up to your Raggle instance.

    image

  3. In the next screen, configure the OAuth application according to how you want it to be displayed to your users.

  4. Ensure that 'Authorized Domains' is setup to point at the URL where your Raggle instance will be deployed. For example, if you want your application to be available at https://search.acmeco.com, add "acmeco.com" URL as an authorized domain.

    NB: This step can be skipped for a localhost deployment.

    If you see the error "Must be a top level domain" when adding your authorized domain, you may need to authenticate your domain with Google. To do so, add your domain as a property with Google Search Console.

    image

  5. Enable all of the default scopes for your application. In addition, add scopes that will allow Raggle to ingest Gmail and Google Drive data.

    Once your scopes have been added, the add/remove scopes table should look like this:

    image

  6. Create credentials for the Google OAuth application.

    1. On the OAuth credentials screen, click 'Create Credentials' and then 'Client OAuth ID'.

      image

    2. Select 'Web Application' and fill in the "Authorized Javascript Origin" and "Authorized Redirect URIs" fields.

      1. In "Authorized Javascript Origin", add the URL where you will host this application. Eg: "https://search.acmeco.com"

      2. In "Authorized Redirect URIs" add the following paths with your URL prefixed.

        • /auth/google_oauth2/callback
        • /_/permissions/google_with_google_drive/callback
        • /_/permissions/google_with_gmail/callback

        For example, if your base URL is https://search.acmeco.com, add https://search.acmeco.com/auth/google_oauth2/callback, https://search.acmeco.com/_/permissions/google_with_google_drive/callback, and https://search.acmeco.com/_/permissions/google_with_gmail/callback as an authorized redirect URI.

      NB: For a localhost deployment, add http://localhost:3000 as the Authorized Javascript Origin and the base URL for the redirect URI suffixes.

    3. Create the credentials and copy the Client ID and Secret. Add these as environment variables to your deployment under GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET.

Clone this wiki locally