Crescendo Lab เอกสาร
ไทย
สมัครใช้งาน

ข้อมูลอ้างอิง API: OAuth

Platform API v1 ส่วน OAuth: path, พารามิเตอร์, ฟิลด์ของคำขอและคำตอบ, scope, idempotency และข้อผิดพลาดของทุก operation จาก contract

อัปเดตล่าสุด
ดู Markdown เปิดใน Claude เปิดใน ChatGPT

สร้างจาก API contract (Agent Lab Platform API 1.0.0-alpha.1) คำอธิบายเป็นภาษาอังกฤษตามต้นฉบับใน contract

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.

Scopeทำในนามของการยืนยันตัวตน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.

Scopeทำในนามของการยืนยันตัวตน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.

Scopeทำในนามของการยืนยันตัวตน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}.

Scopeทำในนามของการยืนยันตัวตน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.

Scopeทำในนามของการยืนยันตัวตน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

Scopeทำในนามของการยืนยันตัวตน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

Scopeทำในนามของการยืนยันตัวตน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[]ใช่—