This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This script auto-generates a Google OAuth token from a Service Account key, | |
* and stores that token in the "access_token" variable in Postman. | |
* | |
* Prior to invoking it, set the following variables in a Postman environment: | |
* - "service_account_key": the contents of your service account key. | |
* - "scope": a space-separated list of Google API scopes, e.g.: | |
* "https://www.googleapis.com/auth/drive https://www.googleapis.com/auth/drive.metadata" | |
* | |
* Then, paste this script into the "Pre-request Script" section | |
* of a Postman request or collection. |