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

No tagged tutorials yet. Fetch Apps Script from the harvest table and this page fills automatically.

Related blog posts

Written guides about ScriptApp.getOAuthToken().

Browse the blog