skip to main content
Using the driver : Authentication : Generating access tokens and refresh tokens
  

Try DataDirect Drivers Now

Generating access tokens and refresh tokens

This section guides you through the process of generating access tokens and refresh tokens that are used to authenticate to Google BigQuery when OAuth 2.0 is set as the authentication method (AuthenticationMethod=oauth2).
To generate an access token and a refresh token from Google Console:
1. Click the following link to navigate to Google Developer Console: https://console.developers.google.com/.
2. Enter your login credentials; then, click Next.
3. On the left pane, click OAuth consent screen.
OAuth 2.0 Playground - Authorize APIs
4. On the OAuth consent screen, enter the following details; then, click Save:
*Application name
*Support email
*Scopes for Google APIs
*Authorized domains
*Application Homepage link
*Application Privacy Policy link
5. On the left pane, click Credentials. Next, from the Create credentials drop-down list, select OAuth client ID.
Create OAuth client ID screen
6. The Create OAuth client ID screen appears. Select Other as your Application type, enter your application's name, and then click Create.
.
Create OAuth client ID screen
7. OAuth client window appears. Copy and save your client ID and client secret from the corresponding fields. You will need them later in this procedure. Note that they can also be accessed from the Credentials screen, if necessary.
OAuth client window
8. Click the following link to navigate to OAuth 2.0 Playground: https://developers.google.com/oauthplayground/.
9. Select the required scopes; then, click Authorize APIs.
OAuth 2.0 Playground - Authorize APIs
Login screen appears.
10. Click your username. The following message appears: "Google OAuth 2.0 Playground wants to access your Google Account."
11. Scroll down and click Allow.
You are redirected to the OAuth 2.0 Playground. It contains the newly generated authorization code for your application.
12. Click Exchange authorization code for tokens.
The refresh token and access token are generated in the corresponding fields.
OAuth 2.0 Playground - Exchange authorization code for tokens