Project

General

Profile

Set up an OAuth service » History » Version 2

Phil Hodgson, 02/18/2015 01:22 PM

1 2 Phil Hodgson
h1. Set up an OAuth service for Reading the Results of Google Surveys
2 1 Tom Clegg
3 2 Phil Hodgson
Tapestry uses Google's OAuth2 to retrieve survey responses from Google Sheets/Drive spreadsheets.
4 1 Tom Clegg
5 2 Phil Hodgson
h2. Administrator Steps
6 1 Tom Clegg
7 2 Phil Hodgson
h3. Set up a Google Account for Interfacing via Oauth
8 1 Tom Clegg
9 2 Phil Hodgson
# Create a Google "Project" within your account here: https://console.developers.google.com/project - name the project whatever you like.
10
# Using the navigator on the left, go to the "APIs" page for your new project.
11
# In the "Browse APIs" secion, find the one labelled "Drive API" and enable it.
12 1 Tom Clegg
13 2 Phil Hodgson
h3. Obtain Client Credentials for your Tapestry Domain
14 1 Tom Clegg
15 2 Phil Hodgson
# Again using the navigator on the left, go to the "Credentials" page for your porject.
16
# Click on the "Create new Client ID" button.
17
# 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!
18
# 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").
19 1 Tom Clegg
20 2 Phil Hodgson
h3. Create the Google OAuth Service in Tapestry
21 1 Tom Clegg
22 2 Phil Hodgson
# As an administrator user, go to the "OAuth Services" page using the "Admin" menu
23
# 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.)
24
# Create a name for the service, e.g. "Google Spreadsheets"
25
# Select "Google" as the service type
26
# Enter "https://accounts.google.com" for the "Endpoint URL"
27
# 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
28
# Enter the "Client ID" and "Client Secret" Google gave you, as the "Key" and "Secret" respectively.
29
# Click on "Create OAuth Service".
30 1 Tom Clegg
31 2 Phil Hodgson
h2. Researcher Steps
32 1 Tom Clegg
33 2 Phil Hodgson
h3. Authorize Tapestry to access to your spreadsheets
34 1 Tom Clegg
35 2 Phil Hodgson
# Go to the "OAuth Tokens" page from the "Researcher" menu.
36
# Click on the "Authorize" button, using Google to authenticate.