---
title: "Exchange authorization code for access token"
method: POST
path: "/oauth/token"
tags: ["oauth"]
---

# Exchange authorization code for access token

`POST /oauth/token`

Exchanges an authorization code for an access token.

## Request body

- ExchangeAuthorizationCodeRequest
  - `provider` 'github', required — The OAuth provider name. - "github": GitHub OAuth.
  - `code` string, required — The OAuth authorization code received from the OAuth callback.

## Response `200`

Successfully exchanged authorization code for access token.

- ExchangeAuthorizationCodeResponse
  - `accessToken` string, required — The OAuth access token that can be used to access the provider's API.

## Other responses

- `400` — - [group:**oauth**, code:**0**]: Unsupported OAuth provider. - [group:**oauth**, code:**2**]: Invalid authorization code. - [group:**request**, code:**0**]: Invalid field in the request. - [group:**request**, code:**1**]: The request body is required.
- `500` — - [group:**oauth**, code:**1200**]: Exchange authorization code encountered error.

---

[API](https://skmtc.net/gmicloud/apis/cluster-engine-api.md) · [All operations](https://skmtc.net/gmicloud/apis/cluster-engine-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/gmicloud/cluster-engine-api/revisions/bcbab016469f/schema)
