AuthorizationException

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

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

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `https://developers.google.com/apps-script/reference/card-service/authorization-exception#printJson()` | `String` | Prints the JSON representation of this object. |
| `https://developers.google.com/apps-script/reference/card-service/authorization-exception#setAuthorizationUrl(String)` | `https://developers.google.com/apps-script/reference/card-service/authorization-exception#` | Sets the authorization URL that user is taken to from the authorization prompt. |
| `https://developers.google.com/apps-script/reference/card-service/authorization-exception#setCustomUiCallback(String)` | `https://developers.google.com/apps-script/reference/card-service/authorization-exception#` | The name of a function to call to generate a custom authorization prompt. |
| `https://developers.google.com/apps-script/reference/card-service/authorization-exception#setResourceDisplayName(String)` | `https://developers.google.com/apps-script/reference/card-service/authorization-exception#` | Sets the name that is displayed to the user when asking for authorization. |
| `https://developers.google.com/apps-script/reference/card-service/authorization-exception#throwException()` | `void` | Triggers 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

| Name | Type | Description |
|---|---|---|
| `authUrl` | `String` | The authorization URL to set. |

#### Return


`https://developers.google.com/apps-script/reference/card-service/authorization-exception#` --- This object, for chaining.

*** ** * ** ***

### `setCustomUiCallback(callback)`

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

#### Parameters

| Name | Type | Description |
|---|---|---|
| `callback` | `String` | The name of the function that generates a custom authorization prompt. |

#### Return


`https://developers.google.com/apps-script/reference/card-service/authorization-exception#` --- This object, for chaining.

*** ** * ** ***

### `setResourceDisplayName(name)`

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

#### Parameters

| Name | Type | Description |
|---|---|---|
| `name` | `String` | The display name. |

#### Return


`https://developers.google.com/apps-script/reference/card-service/authorization-exception#` --- This object, for chaining.

*** ** * ** ***

### `throwException()`

Triggers this exception to be thrown.