Stay organized with collections Save and categorize content based on your preferences.
AuthorizationInfoAn object that checks if the user has granted authorization for the required scopes of the script. The object also provides an authorization URL for users to grant those permissions.
Some script executions can start without a user's consent to all required scopes used by the script. The information in this object lets you control access to sections of code that require certain scopes and request authorization of those scopes for subsequent executions.
This object is returned by ScriptApp.getAuthorizationInfo(authMode)
. In almost all cases, scripts should call ScriptApp.getAuthorizationInfo(ScriptApp.AuthMode.FULL)
, since no other authorization mode requires that users grant authorization.
Gets a value that indicates whether the user needs to authorize this script to use one or more services (for example, ScriptApp.AuthorizationStatus.REQUIRED
).
// Log the authorization status (REQUIRED or NOT_REQUIRED). const authInfo = ScriptApp.getAuthorizationInfo(ScriptApp.AuthMode.FULL); Logger.log(authInfo.getAuthorizationStatus());Return
AuthorizationStatus
— the authorization status
getAuthorizationUrl()
Gets the authorization URL that can be used to grant access to the script. This method returns null
if no authorization is required. The page at the URL will close automatically if it is accessed and the script does not require any authorization.
// Log the URL used to grant access to the script. const authInfo = ScriptApp.getAuthorizationInfo(ScriptApp.AuthMode.FULL); Logger.log(authInfo.getAuthorizationUrl());Return
String
— a URL that can be used to authorize the script
getAuthorizedScopes()
Gets a list of authorized scopes for the script. If authorization information is requested for a specified list of scopes, returns the authorized scopes from the specified list.
// Logs which scopes in the specified list have been authorized for the script. const authInfo = ScriptApp.getAuthorizationInfo(ScriptApp.AuthMode.FULL, [ 'https: //www.googleapis.com/auth/documents', 'https: //www.googleapis.com/auth/spreadsheets', ]); Logger.log(authInfo.getAuthorizedScopes());Return
String[]
— The list of authorized scopes.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-01-08 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-01-08 UTC."],[[["AuthorizationInfo is an object used to determine if a user needs to authorize a script to use services and provides the authorization dialog URL."],["This object is primarily used in add-ons with installable triggers to manage user access or prompt for authorization."],["It offers two methods: `getAuthorizationStatus()` to check if authorization is required, and `getAuthorizationUrl()` to obtain the authorization URL."],["Scripts should generally use `ScriptApp.getAuthorizationInfo(ScriptApp.AuthMode.FULL)` for comprehensive authorization checks."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4