Google BigQuery Dynamic OAuth2

In this article

Overview

Use this SnapLogic Account type to connect Snaps to Google BigQuery using Dynamic OAuth2.

Prerequisites

A valid Access token.

Limitations and Known Issues

None.

Account Settings

  • Asterisk ( * ): Indicates a mandatory field.

  • Suggestion icon ( ): Indicates a list that is dynamically populated based on the configuration.

  • Expression icon ( ): Indicates the value is an expression (if enabled) or a static value (if disabled). Learn more about Using Expressions in SnapLogic.

  • Add icon ( ): Indicates that you can add fields in the fieldset.

  • Remove icon ( ): Indicates that you can remove fields from the fieldset.

Field Name

Field Type

Description

Field Name

Field Type

Description

Label*

 

Default Value: None
Example: google oauth big query dynamic

String

Specify a unique label for the account.

 

Access token*

Default Value: None
Example: dfx863?1mh092=

String/Expression

Specify the access token for the application. This token is passed as 'Authorization: bearer <access_token_value> to the Snap if 'Header authenticated' property is enabled. Some endpoints require an uppercase letter for Bearer, then the property value for the token must be provided as 'Bearer <access_token_value>' for the access token property value. The access token is not refreshable, but can be passed as a Pipeline parameter.

Default Standard SQL

Default Value: Deselected

Checkbox

Select this checkbox if you want to default the dialect in the Query field of the Snaps using this account to Standard SQL.

To override this default setting, use the #legacySQL tag within the Query field of the Snap to treat it as a Legacy SQL query.

 

Generating OAuth2 Access Token using Java Script

When you create a Google Service Account property that contains a private key, client email, and so on, perform the following steps to generate the Access token using Java Script install the Google API for Node.js to generate the token as follows:

  1. Install Node.Js.

  2. Install Google API.
    npm install -S googleapis

  3. Write the script as follows:

    import google from 'googleapis' import googleServiceAccountKey from '/path/to/private/google-service-account-private-key.json' // see docs on how to generate a service account const googleJWTClient = new google.auth.JWT( googleServiceAccountKey.client_email, null, googleServiceAccountKey.private_key, ['https://www.googleapis.com/auth/analytics.readonly'], // You may need to specify scopes other than analytics null, ) googleJWTClient.authorize((error, access_token) => { if (error) {returnconsole.error("Couldn't get access token", e) } // ... access_token ready to use to fetch data and return to client // even serve access_token back to client for use in `gapi.analytics.auth.authorize` })

     

  4. Run the above script to generate the Access token.


Related Content