SSO 一次性登录 code 换 token(BFF 承接回调 302 的 code):签发 TokenResponse + org 成员关系;code 一次性 TTL 2min
POST
/v1/auth/sso/exchange
const url = 'https://api.tansr.com/v1/auth/sso/exchange';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"code":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.tansr.com/v1/auth/sso/exchange \ --header 'Content-Type: application/json' \ --data '{ "code": "example" }'Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
code
required
回调 302 携带的一次性登录 code(BFF 用 code 换 token)
string
Examplegenerated
{ "code": "example"}Responses
Section titled “Responses”TokenResponse + org({…, org: {id, name, role}|null})
Media typeapplication/json
object
key
additional properties
any
Examplegenerated
{}Unauthorized(code 未知/过期 / 账号不可用)
Media typeapplication/json
object
error
required
object
code
required
错误码注册表单源派生(src/http/errors.ts ERROR_CODES;码稳定,消费方按码翻译)
string
message
required
string
requestId
required
string
detail
object
Example
{ "error": { "code": "adjudicator_not_authorized" }}本文是否有帮助?
感谢反馈,我们会持续改进这篇文章。