SSO 首次关联 OTP 二次确认:校验邮箱 OTP(复用既有机制,尝试计数防爆破)→ 写 federated_identity 绑定 (org,issuer,sub)→userId → 返一次性登录 code(BFF 再经 exchange 换 token);link/OTP 一次性
POST
/v1/auth/sso/link/confirm
const url = 'https://api.tansr.com/v1/auth/sso/link/confirm';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"linkToken":"example","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/link/confirm \ --header 'Content-Type: application/json' \ --data '{ "linkToken": "example", "code": "example" }'Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
linkToken
required
回调 302 到 confirm 页携带的一次性 link 令牌
string
code
required
邮箱 OTP 二次确认码(首次关联既有账号)
string
Examplegenerated
{ "linkToken": "example", "code": "example"}Responses
Section titled “Responses”已绑定({code})
Media typeapplication/json
object
code
required
绑定成功后签发的一次性登录 code(再经 /v1/auth/sso/exchange 换 token)
string
Examplegenerated
{ "code": "example"}Bad_request(link 未知/过期)/ otp_invalid
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" }}Forbidden(成员资格已撤 / 账号不可用)
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" }}Otp_rate_limited(尝试过多)
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" }}本文是否有帮助?
感谢反馈,我们会持续改进这篇文章。