LegalStack

OAuth 2.0

OAuth 2.0: authorization, token, revocation, introspection.

Метаданные OAuth 2.0 Authorization Server (RFC 8414)

GET
/.well-known/oauth-authorization-server

Тело ответа

application/json

curl -X GET "https://loading/.well-known/oauth-authorization-server"
{
  "authorization_endpoint": "string",
  "code_challenge_methods_supported": [
    "string"
  ],
  "dpop_signing_alg_values_supported": [
    "string"
  ],
  "grant_types_supported": [
    "string"
  ],
  "introspection_endpoint": "string",
  "introspection_endpoint_auth_methods_supported": [
    "string"
  ],
  "issuer": "string",
  "jwks_uri": "string",
  "registration_endpoint": "string",
  "response_types_supported": [
    "string"
  ],
  "revocation_endpoint": "string",
  "revocation_endpoint_auth_methods_supported": [
    "string"
  ],
  "scopes_supported": [
    "string"
  ],
  "service_documentation": "string",
  "token_endpoint": "string",
  "token_endpoint_auth_methods_supported": [
    "string"
  ],
  "userinfo_endpoint": "string"
}

OpenID Connect Discovery 1.0

GET
/.well-known/openid-configuration

Тело ответа

application/json

curl -X GET "https://loading/.well-known/openid-configuration"
{
  "authorization_endpoint": "string",
  "code_challenge_methods_supported": [
    "string"
  ],
  "dpop_signing_alg_values_supported": [
    "string"
  ],
  "grant_types_supported": [
    "string"
  ],
  "introspection_endpoint": "string",
  "introspection_endpoint_auth_methods_supported": [
    "string"
  ],
  "issuer": "string",
  "jwks_uri": "string",
  "registration_endpoint": "string",
  "response_types_supported": [
    "string"
  ],
  "revocation_endpoint": "string",
  "revocation_endpoint_auth_methods_supported": [
    "string"
  ],
  "scopes_supported": [
    "string"
  ],
  "service_documentation": "string",
  "token_endpoint": "string",
  "token_endpoint_auth_methods_supported": [
    "string"
  ],
  "userinfo_endpoint": "string",
  "property1": null,
  "property2": null
}

Эндпоинт авторизации OAuth 2.0 (RFC 6749 §3.1, PKCE RFC 7636)

GET
/oauth/authorize
АвторизацияBearer <токен>

В: header

Параметры запроса

response_type*string

Только authorization code flow

Значение в"code"
client_id*string

client_id зарегистрированного клиента

redirect_uri*string

Зарегистрированный redirect URI

scope?string

Запрашиваемые scope через пробел

state?string

Непрозрачное значение, возвращается в redirect

nonce?string

OIDC nonce

code_challenge*string

PKCE challenge (обязателен)

code_challenge_method?string

Метод PKCE, только S256

Значение в"S256"
dpop_jkt?string

Отпечаток DPoP-ключа для привязки токенов (RFC 9449 §10)

resource?string

Целевой ресурс (RFC 8707)

Тело ответа

application/json

curl -X GET "https://loading/oauth/authorize?response_type=code&client_id=string&redirect_uri=string&code_challenge=string"
Пусто
{
  "error": "string",
  "error_description": "string"
}

Контекст экрана согласия OAuth (имя клиента, scopes, redirect_uri)

GET
/oauth/authorize/context
АвторизацияBearer <токен>

В: header

Параметры запроса

client_id*string

client_id из authorize-запроса

redirect_uri*string

redirect_uri из authorize-запроса

scope?string

Запрашиваемые scope через пробел

resource?string

Целевой ресурс (RFC 8707)

Тело ответа

application/json

application/json

curl -X GET "https://loading/oauth/authorize/context?client_id=string&redirect_uri=string"
{
  "application_type": "string",
  "client_id": "string",
  "client_name": "string",
  "redirect_uri": "string",
  "resource": "string",
  "scopes": [
    "string"
  ]
}
{
  "error": "string",
  "error_description": "string"
}

Решение пользователя по экрану согласия OAuth (выдача кода или отказ)

POST
/oauth/authorize/decision
АвторизацияBearer <токен>

В: header

Тело запроса

application/json

TypeScript-определения

Используйте тип request body в TypeScript.

Тело ответа

application/json

application/json

curl -X POST "https://loading/oauth/authorize/decision" \  -H "Content-Type: application/json" \  -d '{    "approve": true,    "client_id": "string",    "code_challenge": "string",    "redirect_uri": "string"  }'
{
  "location": "string"
}
{
  "error": "string",
  "error_description": "string"
}

Интроспекция токена (RFC 7662)

POST
/oauth/introspect

Тело запроса

application/x-www-form-urlencoded

TypeScript-определения

Используйте тип request body в TypeScript.

Тело ответа

application/json

application/json

application/json

curl -X POST "https://loading/oauth/introspect" \  -H "Content-Type: application/x-www-form-urlencoded" \  -d 'token=string'
{
  "active": true,
  "aud": "string",
  "client_id": "string",
  "cnf": {
    "jkt": "string"
  },
  "exp": 0,
  "iat": 0,
  "iss": "string",
  "jti": "string",
  "nbf": 0,
  "scope": "string",
  "sub": "string",
  "token_type": "string",
  "username": "string"
}
{
  "error": "string",
  "error_description": "string"
}
{
  "error": "string",
  "error_description": "string"
}

Динамическая регистрация клиента OAuth 2.0 (RFC 7591)

POST
/oauth/register

Тело запроса

application/json

TypeScript-определения

Используйте тип request body в TypeScript.

Тело ответа

application/json

application/json

curl -X POST "https://loading/oauth/register" \  -H "Content-Type: application/json" \  -d '{    "redirect_uris": [      "string"    ]  }'
{
  "application_type": "string",
  "client_id": "string",
  "client_id_issued_at": 0,
  "client_name": "string",
  "grant_types": [
    "string"
  ],
  "redirect_uris": [
    "string"
  ],
  "response_types": [
    "string"
  ],
  "scope": "string",
  "token_endpoint_auth_method": "string"
}
{
  "error": "string",
  "error_description": "string"
}

Отзыв токена (RFC 7009)

POST
/oauth/revoke

Тело запроса

application/x-www-form-urlencoded

TypeScript-определения

Используйте тип request body в TypeScript.

Тело ответа

curl -X POST "https://loading/oauth/revoke" \  -H "Content-Type: application/x-www-form-urlencoded" \  -d 'token=string'
Пусто

Эндпоинт выдачи токенов OAuth 2.0 (RFC 6749 §3.2)

POST
/oauth/token

Тело запроса

application/x-www-form-urlencoded

TypeScript-определения

Используйте тип request body в TypeScript.

Тело ответа

application/json

application/json

application/json

curl -X POST "https://loading/oauth/token" \  -H "Content-Type: application/x-www-form-urlencoded" \  -d 'grant_type=string'
{
  "access_token": "string",
  "expires_in": 0,
  "refresh_token": "string",
  "scope": "string",
  "token_type": "string"
}
{
  "error": "string",
  "error_description": "string"
}
{
  "error": "string",
  "error_description": "string"
}

Эндпоинт UserInfo (профиль текущего пользователя)

GET
/oauth/userinfo
АвторизацияBearer <токен>

В: header

Тело ответа

application/json

application/json

curl -X GET "https://loading/oauth/userinfo"
{
  "email": "string",
  "family_name": "string",
  "given_name": "string",
  "name": "string",
  "sub": "string"
}
{
  "error": "string",
  "error_description": "string"
}