Exchanges a credential for a Google-generated OAuth 2.0 access token or refreshes an access token following the OAuth 2.0 Authorization Framework.
This endpoint supports Google Cloud's unified OAuth flow, accommodating both federated users (for example, from Workforce Identity Federation) and Google Accounts for accessing Google Cloud resources.
The provided credential can be: - An authorization code issued by Google Cloud's unified authorization endpoint. - A refresh token previously issued by this token endpoint.
HTTP request
POST https://cloudoauth.googleapis.com/v1/common/token
The URL uses gRPC Transcoding syntax.
Request body
The request body contains data with the following structure:
| JSON representation |
|---|
{ "grantType": string, "scope": string, "clientId": string, "redirectUri": string, "codeVerifier": string, "code": string, "refreshToken": string, "clientSecret": string, "parent": string } |
| Fields | |
|---|---|
grantType |
Required. The grant types are as follows:
|
scope |
Optional. A list of scopes that are requested for the token to be returned. See Scope. Must be a list of space-delimited, case-sensitive strings. Note: Currently, specifying scopes in the request is not supported. |
clientId |
Optional. The client identifier for the OAuth 2.0 client that requested the provided token. It is required when the client is not authenticating with the authorization server, for example, when authentication method is client authentication. |
redirectUri |
Optional. The redirect URI. Required if |
codeVerifier |
Optional. The code verifier for the PKCE request. Application (Client) originally generates it before the authorization request. PKCE is used to protect authorization code from interception attacks. See PKCE and PKCE. Required if |
code |
Optional. The authorization code that was previously obtained from Google Cloud's unified authorization endpoint. Required if the flow is authorization code flow, for example, if |
refreshToken |
Optional. Credential used to obtain a new access token when the current access token becomes invalid or expires. Required when using refresh token flow, for example, if |
clientSecret |
Optional. To use a client secret for client authentication in the request-body, the client uses the Note: According to the RFC, the client must not use more than one authentication method for any given request; using both will result in an error. Also, it is recommended to use the HTTP Basic authentication scheme instead of this parameter, if feasible. For more information, see https://datatracker.ietf.org/doc/html/rfc6749#section-2.3.1 |
parent |
Optional. The resource name of the parent organization. Format: |
Response body
If successful, the response body contains an instance of ExchangeTokenResponse.