Skip to main content
Version: 1.x.x

Working With External Data Via OAuth

To illustrate how to work with external data, we will walk through an example of how to use the auth system to retrieve a list of files in the user's Google Drive.

First, add an OAUTH2 type auth configuration to your App. It should look something like this.

Name:
"gdrive"

Authorization URL:
"https://accounts.google.com/o/oauth2/v2/auth"

Token URL:
"https://www.googleapis.com/oauth2/v4/token"

Client ID:
"..."

Client Secret:
"..."

Scope:
"https://www.googleapis.com/auth/drive.readonly https://www.googleapis.com/auth/drive.metadata.readonly"

Proxy API Domains:
"https://*.googleapis.com"
Then, copy the generated `Redirect URL` on auth configuration page and set it in the client app configuration on the third party platform.

Now, you can use the Auth API to trigger an auth flow and retrieve the a list of your your files from Google Drive.

quip.apps.auth("gdrive")
.login({
"access_type": "offline",
"prompt": "consent",
})
.then(() => {
return quip.apps.auth("gdrive").request({
url: "https://www.googleapis.com/drive/files/root"
}).then(response => response.json());
})
.catch(error => console.log("Auth failed", error));

Please see our auth documentation for more information on how to use the auth system.