## ExchangeToken `client.Identity.ExchangeToken(ctx, body) (*IdentityExchangeTokenResponse, error)` **post** `/gitpod.v1.IdentityService/ExchangeToken` Exchanges an exchange token for a new access token. Use this method to: - Convert exchange tokens to access tokens - Obtain new access credentials - Complete token exchange flows ### Examples - Exchange token: Trades an exchange token for an access token. ```yaml exchangeToken: "exchange-token-value" ``` ### Parameters - `body IdentityExchangeTokenParams` - `ExchangeToken param.Field[string]` exchange_token is the token to exchange ### Returns - `type IdentityExchangeTokenResponse struct{…}` - `AccessToken string` access_token is the new access token ### Example ```go package main import ( "context" "fmt" "github.com/gitpod-io/gitpod-sdk-go" "github.com/gitpod-io/gitpod-sdk-go/option" ) func main() { client := gitpod.NewClient( option.WithBearerToken("My Bearer Token"), ) response, err := client.Identity.ExchangeToken(context.TODO(), gitpod.IdentityExchangeTokenParams{ ExchangeToken: gitpod.F("exchange-token-value"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", response.AccessToken) } ``` #### Response ```json { "accessToken": "accessToken" } ```