Google Sheets

Enhanced Advanced

Create OAuth2 developer application in Google

The Google Cloud administrator registers an OAuth Client ID in Google.

Create Google OAuth integration.

They will need the Posit Connect redirect URL which is defined as https://connect.example.org/__oauth__/integrations/callback

Note

Replace connect.example.org with the address of the Connect server.

The Connect Administrator must obtain the client ID and client secret from the Google Cloud administrator.

Note

Google requires Confidential OAuth clients. Public clients are not allowed.

Transfer information to Connect administrator

The Google administrator shares the following information with the Connect administrator:

Field Description
client_id The unique identifier of the Google Oauth application.
client_secret The secret string for the Google OAuth application.
scopes The permissions requested by Connect. See the discussion on Scopes below for additional details.

Scopes

APIs and Services that are enabled for your Google Cloud project can be set within your Google Sheets OAuth integration using scopes. By default the read and write Google Sheets and Google Drive scopes are included with the Sheets OAuth integration, but these can be modified to be less permissive. Without the Drive scope it is not possible to list spreadsheets available to the user, as this functionality is not part of the Sheets API.

For more information, please see the full list of Sheets v4 API OAuth2 scopes.

Create OAuth integration in Connect

The Connect administrator creates an OAuth integration through the Integrations tab on the Connect dashboard. Once the OAuth integration has been created in Connect, it is available for use by all publishers.

Create Google Sheets OAuth integration.

Alternatively, the example below shows how to create a Google Sheets OAuth integration using curl and the Connect Server API.

Note

Replace connect.example.org with the address of the Connect server.

Terminal
curl -H "Authorization: Key ${CONNECT_API_KEY}" \
  -XPOST https://connect.example.org/__api__/v1/oauth/integrations \
  --data '{
    "template": "sheets",
    "name": "Google Sheets",
    "description": "A helpful description for publishers to use when choosing an OAuth integration for their content.",
    "config": {
      "client_id": "<client-id>",
      "client_secret": "<client-secret>",
      "auth_mode": "Confidential",
      "scopes": "https://www.googleapis.com/auth/spreadsheets https://www.googleapis.com/auth/drive"
    }
  }'
# 200 OK
# {"guid": "<oauth-integration-guid>", ... }