Skip to content
Ona Docs

ExchangeToken

identity.exchange_token(IdentityExchangeTokenParams**kwargs) -> IdentityExchangeTokenResponse
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
exchange_token: Optional[str]

exchange_token is the token to exchange

ReturnsExpand Collapse
class IdentityExchangeTokenResponse:
access_token: Optional[str]

access_token is the new access token

ExchangeToken

import os
from gitpod import Gitpod

client = Gitpod(
    bearer_token=os.environ.get("GITPOD_API_KEY"),  # This is the default and can be omitted
)
response = client.identity.exchange_token(
    exchange_token="exchange-token-value",
)
print(response.access_token)
{
  "accessToken": "accessToken"
}
Returns Examples
{
  "accessToken": "accessToken"
}