Skip to content
Ona Docs

ExchangeToken

client.identity.exchangeToken(IdentityExchangeTokenParams { exchangeToken } body, RequestOptionsoptions?): IdentityExchangeTokenResponse { accessToken }
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.

    exchangeToken: "exchange-token-value"
ParametersExpand Collapse
body: IdentityExchangeTokenParams { exchangeToken }
exchangeToken?: string

exchange_token is the token to exchange

ReturnsExpand Collapse
IdentityExchangeTokenResponse { accessToken }
accessToken?: string

access_token is the new access token

ExchangeToken

import Gitpod from '@gitpod/sdk';

const client = new Gitpod({
  bearerToken: process.env['GITPOD_API_KEY'], // This is the default and can be omitted
});

const response = await client.identity.exchangeToken({ exchangeToken: 'exchange-token-value' });

console.log(response.accessToken);
{
  "accessToken": "accessToken"
}
Returns Examples
{
  "accessToken": "accessToken"
}