POST /oauth/token
Обменивает authorization code на токены или обновляет access token через refresh token.
Content-Type: application/x-www-form-urlencoded
Authorization Code
POST /oauth/token
Content-Type: application/x-www-form-urlencoded
grant_type=authorization_code
&code=AUTHORIZATION_CODE
&redirect_uri=https://app.example.com/callback
&client_id=my-app
&client_secret=my-secret
&code_verifier=CODE_VERIFIER
Refresh Token
POST /oauth/token
Content-Type: application/x-www-form-urlencoded
grant_type=refresh_token
&refresh_token=REFRESH_TOKEN
&client_id=my-app
&client_secret=my-secret
Успешный ответ
{
"access_token": "eyJhbGciOiJSUzI1NiJ9...",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "dGhpcyBpcyBh...",
"scope": "openid profile email",
"id_token": "eyJhbGciOiJSUzI1NiJ9..."
}
Ошибки
| Код | HTTP | Описание |
|---|---|---|
invalid_grant |
400 | Код или refresh token недействителен или истёк |
invalid_client |
401 | Неверный client_id или client_secret |
invalid_request |
400 | Отсутствует обязательный параметр |
unsupported_grant_type |
400 | Данный grant type не поддерживается |