You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit fbc477f
Browse filesBrowse the repository at this point in the historyBrowse files
- On the resulting popup screen, find and click "DOWNLOAD JSON" and save this file to a secure location.
274
274
275
-
## Use the Postman application to query the OAuth enpoint and retrieve an access token
276
-
277
-
Initially, you'll need to configure an authentication request using Postman's built-in OAuth 2.0 implementation:
278
-
279
-
- Open Postman
280
-
- Create a new request
281
-
- Switch to the "Authorization" tab
282
-
- On the left side, select Type OAuth 2.0
283
-
- On the right side, scroll down to the "Configure New Token" section
284
-
- Fill out the form using information from the downloaded json file from the
285
-
previous section
286
-
- Token Name: Google Oauth
287
-
- Grant Type: Authorization Code
288
-
- Auth URL: (found in the json file as auth_url)
289
-
- Access Token URL: (found in the json file as token_url)
290
-
- Client ID: (found in the json file as client_id)
291
-
- Client Secret: (found in the json file as client_secret)
292
-
- Scope:
293
-
https://www.googleapis.com/auth/gmail.readonly
294
-
https://www.googleapis.com/auth/gmail.send
295
-
- State: (any random string is fine)
296
-
- Client Authentication: Send as Basic Auth header
297
-
298
-
Once the form is filled out, repeat these steps each hour to retrieve a new
299
-
access token:
300
-
301
-
- Click on "Get New Access Token"
302
-
- A browser will open and you'll be asked to authenticate with your Google Account
303
-
- Accept the request to allow this OAuth session to access your Google Account.
304
-
- In the MANAGE ACCESS TOKENS popup, find and copy the new Access Token
305
-
- This access token will be valid for 1 hour.
275
+
## Retrieve an access token
276
+
277
+
- Navigate to [OAuth 2.0 Playground](https://developers.google.com/oauthplayground/).
278
+
- Find *Step 1 Select & authorize APIs*:
279
+
- Find the section for *Gmail API v1*.
280
+
- Mark the following two scopes:
281
+
-https://www.googleapis.com/auth/gmail.readonly
282
+
-https://www.googleapis.com/auth/gmail.send
283
+
- In the box labeled with the watermark *Input your own scopes* add `openid`.
284
+
- Click on the **Authorize APIs** button.
285
+
- Log in to the Google account to which you want to grant access.
286
+
- On the *Sign in to Google OAuth 2.0 Playground* screen, Click **Continue**.
287
+
- On the *Google OAuth 2.0 Playground wants access to your Google Account* screen:
288
+
-**Select all**, including:
289
+
-**View your email messages and settings**.
290
+
-**Send email on your behalf**.
291
+
- Click **Continue**.
292
+
- Find *Step 2 Exchange authorization code for tokens*:
293
+
-*Authorization code* will be prepopulated.
294
+
- Click **Exchange authorization code for tokens**.
295
+
-*Refresh token* and *Access token* will be populated briefly before the interface automatically advances to *Step 3 Configure request to API*. To view the *Access token*, return to *Step 2 Exchange authorization code for tokens*.
296
+
- The *Access token* is valid for 1 hour. You may enable **Auto-refresh the token before it expires** or manually refresh it using the **Refresh access token** button.
306
297
307
298
## Configure OpenFn CLI to find the access token
308
299
@@ -320,7 +311,7 @@ Example configuration using a workflow:
320
311
],
321
312
"expression": "path/to/gmail.js",
322
313
"configuration": {
323
-
"access_token": "(access token acquired from Postman)"
314
+
"access_token": "[access token acquired from previous section]"
0 commit comments