Crescendo Lab ドキュメント
日本語
無料で始める

OAuth API リファレンス

Platform API v1 の OAuth:各操作のパス、パラメーター、リクエストとレスポンスのフィールド、スコープ、冪等性、エラーをコントラクトから掲載します。

最終更新

API コントラクト(Agent Lab Platform API 1.0.0-alpha.1)から生成しています。説明文はコントラクトの英語の原文のままです。

Sign-in and tokens for applications (RFC 6749, 7009, 7662; OpenID Connect).

Start authorization (authorization code with PKCE)#

GET /v1/oauth/authorize

A browser navigation, not an API call. scope=install asks a workspace administrator to install the application (never combined with another scope). A valid request is redirected to the consent screen (or, for an operators' own application with a signed-in person, straight back to the client). An invalid one is answered here and never redirected to an unverified URI.

スコープ実行主体認証Idempotency-Key
なし—なし—

パラメーター

名前場所型必須説明
client_idquerystringはい—
redirect_uriquerystringはい—
code_challengequerystringはい—
code_challenge_methodquerystringはい値: S256.
response_typequerystringいいえ—
statequerystringいいえ—
resourcequerystringいいえ—
scopequerystringいいえ—
noncequerystringいいえ—
organization_idquerystring (uuid)いいえThe workspace to preselect on the consent screen, by id. A hint only.
organizationquerystringいいえThe same hint by the workspace's short name.

レスポンス

ステータスボディ説明
302—To the consent screen, or back to the client.
400application/json: OAuthErrorThe request is invalid.
500application/json: LegacyErrorStringThe consent screen's address is misconfigured.

Exchange a code, refresh a token, or get an installation token#

POST /v1/oauth/token

Three grants:

  • authorization_code (with PKCE): a person's sign-in. When the code came from an install request (scope=install at /v1/oauth/authorize), the answer names the installation and carries no token (InstallResult).
  • refresh_token: a new access token for the same sign-in.
  • client_credentials: an installed application's server asks for a one-hour installation token, naming the installation by installation_id or workspace_id. No refresh token: the application asks again. Refused alike unless the client authenticated with its secret, the installation is live for that client, and its workspace still allows it.

A workspace application authenticates with its secret, by HTTP Basic (client_secret_basic, each half form-encoded first) or in the body (client_secret_post); both at once must name the same client and the secret may be sent only once. Any other client is public and sends only client_id. Requests that carry a secret are rate limited per address.

スコープ実行主体認証Idempotency-Key
なし—clientSecretBasic—

リクエストボディ

application/x-www-form-urlencoded: TokenRequest

フィールド型必須説明
grant_typestringはい値: authorization_code, refresh_token, client_credentials.
codestringいいえ—
code_verifierstringいいえ—
client_idstringいいえ—
client_secretstringいいえclient_secret_post; a workspace application's secret.
redirect_uristringいいえ—
resourcestringいいえ—
refresh_tokenstringいいえ—
installation_idstringいいえclient_credentials: the installation, by id.
workspace_idstringいいえclient_credentials: the installation, by the workspace it is in.
scopestringいいえclient_credentials: install or absent.

レスポンス

ステータスボディ説明
200application/json: TokenResponse または InstallationTokenResponse または InstallResultThe tokens, or where an application was installed. Never cached.
400application/json: OAuthErrorinvalid_grant, invalid_request or unsupported_grant_type.
401application/json: OAuthErrorinvalid_client: the client authentication is missing, wrong or malformed.
429application/json: OAuthErrorToo many requests carrying a secret from this address, or tokens for this client.
503application/json: OAuthErrorTry again.

Revoke a token (RFC 7009)#

POST /v1/oauth/revoke

Answers 200 whether or not the token named anything.

スコープ実行主体認証Idempotency-Key
なし—なし—

リクエストボディ

application/x-www-form-urlencoded: object

フィールド型必須説明
tokenstringいいえ—
client_idstringいいえ—

レスポンス

ステータスボディ説明
200—Revoked, or nothing to revoke.
503application/json: OAuthErrorStorage is unavailable; try again.

Introspect a token (RFC 7662)#

POST /v1/oauth/introspect

The application's server asks whether a bearer token is one the platform honors, and as whom: an operators' application about its sign-in tokens, a workspace application about its sign-in and installation tokens. Server to server only (no CORS). A token that is unknown, expired, revoked, for another audience or issued to any other client answers {"active": false}.

スコープ実行主体認証Idempotency-Key
なし—clientSecretBasic—

リクエストボディ

application/x-www-form-urlencoded: object

フィールド型必須説明
tokenstringはい—
token_type_hintstringいいえ—

レスポンス

ステータスボディ説明
200application/json: IntrospectionThe token's state. Never cached.
400application/json: OAuthErrortoken is missing.
401application/json: OAuthErrorThe client credential is missing or wrong.
429application/json: OAuthErrorToo many requests from this address or client.
503application/json: OAuthErrorTry again.

The signed-in person (OpenID Connect userinfo)#

GET /v1/oauth/userinfo

For a sign-in's token of any client. Only an operators' application's page may call it from a browser; any other client calls it from its server.

スコープ実行主体認証Idempotency-Key
なし—personToken—

レスポンス

ステータスボディ説明
200application/json: UserInfoThe claims the token's scope allows, and the workspace it is bound to.
401application/json: OAuthErrorNo token, or one this endpoint does not honor.
403application/json: OAuthErrorSent from a page that is not the application's registered origin.
503application/json: OAuthErrorTry again.

The signed-in person (OpenID Connect userinfo, POST form)#

POST /v1/oauth/userinfo

スコープ実行主体認証Idempotency-Key
なし—personToken—

レスポンス

ステータスボディ説明
200application/json: UserInfoThe claims the token's scope allows, and the workspace it is bound to.
401application/json: OAuthErrorNo token, or one this endpoint does not honor.
403application/json: OAuthErrorSent from a page that is not the application's registered origin.
503application/json: OAuthErrorTry again.

The keys that sign ID tokens#

GET /v1/oauth/jwks.json

スコープ実行主体認証Idempotency-Key
なし—なし—

レスポンス

ステータスボディ説明
200application/json: objectA JSON Web Key Set (public keys only).
404application/json: OAuthErrorID tokens are not configured on this server.

200 application/json

フィールド型必須説明
keysobject[]はい—