Skip to main content

Google Workspace: Generate Token

Enable APIs

  1. Go to the Google Developer Console.
  2. Click Select a Project >> New Project. If you have an existing project, you can select it from ALL.
10.1step2
  1. Provide valid values, and click Create.
10.1step2
  1. Navigate to Dashboard, and click on ENABLE APIS AND SERVICES.
10.1step2
  1. Search for Google Drive API and Google Sheets API, and click Enable.
10.1step2
10.1step2

Get a Client ID and Client Secret

  1. Navigate to the tab OAuth consent screen and choose the valid option.
10.1step2
  1. Enter the Application name and Authorized domains, and click Save.
10.1step2
  1. Click Credentials tab >> Create Credentials, and OAuth client ID from the dropdown list.
10.1step2
  1. In the Application type list, select Web Application.
10.1step2
  1. Enter valid Name and Authorized Redirect URIs, and click Create.
10.1step2
  1. Copy Client ID and Client Secret, and click OK.
10.1step2
  1. Click OAuth 2.0 Client IDs, and get Client ID and Client Secret.
10.1step2

Generate Refresh Token

  1. Go to the Google OAuth Playground
  2. Click Settings icon.
  3. Click Use your own OAuth credentials, and enter OAuth Client ID and OAuth Client secret generated in Get Client ID and Client Secret
10.1step2
  1. Select Select & authorize APIs. Select the desired scope you want for your application and click on Authorize APIs. Required Scope:
    https://www.googleapis.com/auth/admin.directory.user
    https://www.googleapis.com/auth/admin.directory.domain
    https://www.googleapis.com/auth/admin.directory.group
10.1step2
  1. Click on Exchange authorization code for tokens.
10.1step2
  1. You’ll get the Authorization code, click on the Exchange authorization code for tokens button.
  2. Copy Refresh Token.