Set up an OAuth service for Reading the Results of Google Surveys

Tapestry uses Google's OAuth2 to retrieve survey responses from Google Sheets/Drive spreadsheets.

Administrator Steps

Set up a Google Account for Interfacing via Oauth

  1. Create a Google "Project" within your account here: https://console.developers.google.com/project - name the project whatever you like.
  2. Using the navigator on the left, go to the "APIs" page for your new project.
  3. In the "Browse APIs" secion, find the one labelled "Drive API" and enable it.

Obtain Client Credentials for your Tapestry Domain

  1. Again using the navigator on the left, go to the "Credentials" page for your porject.
  2. Click on the "Create new Client ID" button.
  3. Select the "Web Application" type of Client ID and then configure the consent screen as instructed. When asked to specify the Authorized Javascript Origins and Redirect URIs, change the "www.example.com" for the hostname of the Tapestry installation your researchers will be connecting to. Important: Leave the "/oauth2callback" suffix as is!
  4. You will need the "Client ID" and the "Client Secret" that results from this, and you should also note the exact full "Redirect URI" (a.k.a. "Callback URI").

Create the Google OAuth Service in Tapestry

  1. As an administrator user, go to the "OAuth Services" page using the "Admin" menu
  2. If there is an existing Google OAuth service, you should remove or modify it to use your new credentials. (Note: a service can only be removed if no tokens exist for it.)
  3. Create a name for the service, e.g. "Google Spreadsheets"
  4. Select "Google" as the service type
  5. Enter "https://accounts.google.com" for the "Endpoint URL"
  6. Enter the Redirect URI from above as the "Callback URL" - remember that it must be of the form "https://your.tapestry.hostname/oauth2callback" to function
  7. Enter the "Client ID" and "Client Secret" Google gave you, as the "Key" and "Secret" respectively.
  8. Click on "Create OAuth Service".

Researcher Steps

Authorize Tapestry to access to your spreadsheets

  1. Go to the "OAuth Tokens" page from the "Researcher" menu.
  2. Click on the "Authorize" button, using Google to authenticate.