Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Applies to Write-Back Server and Write-Back Cloud

Table of Contents

Summary

This guide will explain how to get your Google OAuth credentials.
You will be guided through all the steps in order to configure your BigQuery project in order to get the required data to authenticate on BigQuery.

Guide

You have tow two options tow to authenticate on your BigQuery account :

...

Note

When configuring your BigQuery project, if your project has status “Testing“ and is configured for external users, the generated access tokens will have the validity of 7 days.

In order to To get your Access and Refresh Tokens you will need to get your Client and Secret Id.

To get the Access Token and Refresh token, we need to:

  1. Create an OAuth ClientID to get ClientID and Client Secret.

  2. Send an Authorization request to Google to get the Authorization Code.

  3. Exchange the Authorization Code to get the Access Token and Refresh Token by sending a Token request to Google.

  4. To simplify the previous 2 steps, we will use Google OAuth 2 Playgound.

Register OAuth ClientID

  1. To Register a new OAuth ClientID, go to Google Developer Console and login.

  2. Go to the tab OAuth Consent Screen, and fill in the details for your OAuth Client:

    1. Application Name: Your Application Name

    2. Support Email: Your Email/ Support Email

    3. Scopes for Google APIs:
      Add Scope -> BigQuery API ../auth/bigquery

    4. Authorized Domains: Any public facing website

    5. Application HomePage: Any public facing website

    6. Application Privacy Policy Link: Your Privacy policy

    7. Below is an example of the consent screen for your reference –

...

3. Click on Save.

4. Go to Credentials tab, click on Create Credentials, and choose OAuth Client ID.

...

5. Now we should see a screen like below asking for our application type. Choose Web application, provide a name, and click Create.

...

6. We should now see a new popup with our ClientID and Client Secret. Save them, we will need them later.

...

Get Access and Refresh Tokens

  1. Access Google OAuth Playground here: https://developers.google.com/oauthplayground/

  2. Make sure you enable “Use your own OAtuh credentials“ checkbox and type your ClientId and ClientSecret

    Image Modified
  3. Select the following scopes and click on “Authorize APIs“ button.

    Image Modified
  4. Enable both

...

  1. permissions and click “Continue“

    Image Modified
  2. Click on “Exchange authorization code for tokens“ button.

    Image Modified
  3. You will receive and Access and Refresh Token

    Image Modified


Service Account

In order to configura To configure a Service Account you need to:

  • Create a Service Account

  • Get the private key file

Create a Service

...

Account

  1. Go to Credentials tab, click on Create Credentials and choose Service Account.

    Image Modified

  2. Define a Project name and a Project Id.

    Image Modified
  3. Click Create and Continue.

  4. Define the role to this Service Account. Choose BigQuery Admin.

    Image Modified
  5. Click continue.

  6. Define the users to have access to this Service Account.

    Image Modified
  7. Click Done

Get your private key file

  1. Select the account you just created.

    Image Modified
  2. Click on Keys tab.

    Image Modified
  3. Click Add Key. Add select Create new Key option.

  4. Select

...

  1. JSON format.

    Image Modified
  2. Click create.

Info

Currently, only json format is supported.

...