- [HTTP request](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.dataConnector/acquireAndStoreRefreshToken#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.dataConnector/acquireAndStoreRefreshToken#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.dataConnector/acquireAndStoreRefreshToken#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.dataConnector/acquireAndStoreRefreshToken#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.dataConnector/acquireAndStoreRefreshToken#body.response_body)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.dataConnector/acquireAndStoreRefreshToken#body.AcquireAndStoreRefreshTokenResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.dataConnector/acquireAndStoreRefreshToken#body.aspect)
- [IAM Permissions](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.dataConnector/acquireAndStoreRefreshToken#body.aspect_1)
- [AdditionalOAuthResponse](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.dataConnector/acquireAndStoreRefreshToken#AdditionalOAuthResponse)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.dataConnector/acquireAndStoreRefreshToken#AdditionalOAuthResponse.SCHEMA_REPRESENTATION)

Exchanges OAuth authorization credentials for a refresh token and stores the refresh token and the scopes. The stored data will be keyed by the connector name and the user identifier from the EUC.

### HTTP request

Choose an endpoint:
global us   
`POST https://discoveryengine.googleapis.com/v1alpha/{name=projects/*/locations/*/collections/*/dataConnector}:acquireAndStoreRefreshToken`

<br />

The URLs use [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `name` | `string` Required. Connector resource. The connector name identifies the 3rd party system to use for authorization. It is also used as a key to store the refresh token. |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "scopes": [ string ], "fullRedirectUri": string, "instanceUri": string } ``` |

| Fields ||
|---|---|
| `scopes[]` | `string` The scopes of the authorization code and the refresh token. |
| `fullRedirectUri` | `string` Required. The URI the user is redirected to after authorization, including all parameters. E.g., `https://example.com/redir?code=5` |
| `instanceUri` | `string` Optional. The instance URI for the connector, if provided, supported connectors will use this instance URI to construct the token exchange URL. For example, Shopify instance URI is the shop URL. |

### Response body

Response message for `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.dataConnector/acquireAndStoreRefreshToken#google.cloud.discoveryengine.v1alpha.DataConnectorService.AcquireAndStoreRefreshToken` method.

If successful, the response body contains data with the following structure:

| JSON representation |
|---|
| ``` { "additionalOauthResponses": [ { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.dataConnector/acquireAndStoreRefreshToken#AdditionalOAuthResponse`) } ] } ``` |

| Fields ||
|---|---|
| `additionalOauthResponses[]` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.dataConnector/acquireAndStoreRefreshToken#AdditionalOAuthResponse`)`` Optional. Additional OAuth responses from the authorization response. This field is optional and will not always be populated. It depends on the connector's type and the authorization response. |

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/cloud-platform`
- `https://www.googleapis.com/auth/discoveryengine.assist.readwrite`
- `https://www.googleapis.com/auth/discoveryengine.readwrite`
- `https://www.googleapis.com/auth/discoveryengine.serving.readwrite`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).

### IAM Permissions

Requires the following [IAM](https://cloud.google.com/iam/docs) permission on the `name` resource:

- `discoveryengine.dataConnectors.acquireAndStoreRefreshToken`

For more information, see the [IAM documentation](https://cloud.google.com/iam/docs).

## AdditionalOAuthResponse

Additional OAuth responses from the authorization response.

| JSON representation |
|---|
| ``` { "key": string, // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "stringValue": string, "intValue": string, "boolValue": boolean // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| `key` | `string` The key of the additional OAuth response. |
| The value of the additional OAuth response. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `stringValue` | `string` The string value of the additional OAuth response. |
| `intValue` | `string (https://developers.google.com/discovery/v1/type-format format)` The integer value of the additional OAuth response. |
| `boolValue` | `boolean` The boolean value of the additional OAuth response. |
| End of mutually exclusive fields. ||