class ScriptApp method .getOAuthToken()

ScriptApp is the Apps Script service.

.getOAuthToken() is the method name you will see after a dot in your code.

What it does

Returns an OAuth token for calling Google APIs as the user.

Why it's used

  • Call advanced Google APIs with the user's auth.
  • Pass a bearer token to UrlFetchApp requests to Google services.

Common errors

  • Forgetting parentheses on getOAuthToken. Write ScriptApp.getOAuthToken(), not ScriptApp.getOAuthToken or getOAuthToken by itself.
  • Skipping dots between chained calls. Each step needs a dot, like ScriptApp.getOAuthToken().
  • Adding spaces where they do not belong. Write ScriptApp.getOAuthToken(), not ScriptApp .getOAuthToken(), ScriptApp.getOAuthToken (), or ScriptApp . getOAuthToken().
  • Wrong capitalization. Use ScriptApp and getOAuthToken, not scriptapp or getoauthtoken.

Explore

Related methods

Better Sheets tutorials

How To Download All Tabs as CSV in a Zip File

How To Download All Tabs as CSV in a Zip File

Download All Tabs as CSV in a Zip File, instead of downloading each one ...
Visicalc 2023 Design Walkthrough

Visicalc 2023 Design Walkthrough

Design walkthrough of VisiCalc 2023. Watch this if you'd like to see the...
Visicalc 2023 Quick Walkthrough

Visicalc 2023 Quick Walkthrough

This is a fun template I created for April 1st. Take a quick walk throug...

Related blog posts

Written guides about ScriptApp.getOAuthToken().

Browse the blog