# Google Cloud Tasks V2 Client - Class OAuthToken (2.2.0)

2.2.0 (latest) 2.1.2 2.0.2 1.15.2 1.14.6 1.13.2 1.12.2 1.11.11 Reference documentation and code samples for the Google Cloud Tasks V2 Client class OAuthToken.

Contains information needed for generating an
[OAuth token](https://developers.google.com/identity/protocols/OAuth2).

This type of authorization should generally only be used when calling Google
APIs hosted on \*.googleapis.com.

Generated from protobuf message `google.cloud.tasks.v2.OAuthToken`

## Namespace

Google \\ Cloud \\ Tasks \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ service_account_email` | `string` [Service account email](https://cloud.google.com/iam/docs/service-accounts) to be used for generating OAuth token. The service account must be within the same project as the queue. The caller must have iam.serviceAccounts.actAs permission for the service account. |
| `↳ scope` | `string` OAuth scope to be used for generating OAuth access token. If not specified, "<https://www.googleapis.com/auth/cloud-platform>" will be used. |

### getServiceAccountEmail

[Service account email](https://cloud.google.com/iam/docs/service-accounts)
to be used for generating OAuth token.

The service account must be within the same project as the queue. The
caller must have iam.serviceAccounts.actAs permission for the service
account.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setServiceAccountEmail

[Service account email](https://cloud.google.com/iam/docs/service-accounts)
to be used for generating OAuth token.

The service account must be within the same project as the queue. The
caller must have iam.serviceAccounts.actAs permission for the service
account.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getScope

OAuth scope to be used for generating OAuth access token.

If not specified, "<https://www.googleapis.com/auth/cloud-platform>"
will be used.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setScope

OAuth scope to be used for generating OAuth access token.

If not specified, "<https://www.googleapis.com/auth/cloud-platform>"
will be used.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |