Class AuthorizationException

  • AuthorizationException is an error used to trigger an authorization card for the user.

  • Key methods include setting the authorization URL and resource display name.

  • The exception can be configured with a custom UI callback function.

  • Use throwException() to trigger the authorization card.

AuthorizationException

An error that can be returned to trigger an authorization card to be shown to the user.

CardService.newAuthorizationException()
.setAuthorizationUrl('http://auth.com/')
.setResourceDisplayName('Example Resource')
.throwException();

Methods

MethodReturn typeBrief description
printJson() StringPrints the JSON representation of this object.
setAuthorizationUrl(authUrl) AuthorizationException Sets the authorization URL that user is taken to from the authorization prompt.
setCustomUiCallback(callback) AuthorizationException The name of a function to call to generate a custom authorization prompt.
setResourceDisplayName(name) AuthorizationException Sets the name that is displayed to the user when asking for authorization.
throwException() voidTriggers this exception to be thrown.

Detailed documentation

printJson()

Prints the JSON representation of this object. This is for debugging only.

Return

String


setAuthorizationUrl(authUrl)

Sets the authorization URL that user is taken to from the authorization prompt. Required.

Parameters

NameTypeDescription
authUrlStringThe authorization URL to set.

Return

AuthorizationException — This object, for chaining.


setCustomUiCallback(callback)

The name of a function to call to generate a custom authorization prompt. Optional.

Parameters

NameTypeDescription
callbackStringThe name of the function that generates a custom authorization prompt.

Return

AuthorizationException — This object, for chaining.


setResourceDisplayName(name)

Sets the name that is displayed to the user when asking for authorization. Required.

Parameters

NameTypeDescription
nameStringThe display name.

Return

AuthorizationException — This object, for chaining.


throwException()

Triggers this exception to be thrown.

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 2024年12月02日 UTC.