账号与会话
租户会话由登录接口签发。accessToken 用于控制台管理请求,refreshToken 用于刷新及退出会话。调用 auth.refresh 后,使用 setAccessToken 保存新的访问令牌;刷新令牌由业务服务持久化。SDK 不自动刷新会话。
OAuth 授权返回 authorizeUrl 和 state。业务前端打开授权地址,回调时将 code、state 与原始 redirectUri 交给服务端。微信回调的 nextAction=bind_phone 表示需要使用 bindTicket 完成手机号验证。浏览器窗口、跳转及会话存储由业务应用处理。
auth.methods 按请求域名返回可用的登录方式与验证码配置。captcha.enabled=true 时,短信发码请求传入验证码组件返回的 captchaTicket 和 captchaRandstr。
auth.methods
登录方式。
GET /v1/auth/methods
鉴权:公开接口。
| 语言 | 调用 |
|---|---|
| Node.js | c.auth.methods() |
| Python | c.auth.methods() |
| Java | c.auth.methods() |
| Go | c.Auth.Methods(ctx, &result) |
| PHP | $c->auth->methods() |
无请求字段。
返回:AuthMethods。嵌套字段见共享类型。
auth.sendSms
发送短信验证码。
POST /v1/auth/sms/send
鉴权:公开接口。
| 语言 | 调用 |
|---|---|
| Node.js | c.auth.sendSms(input) |
| Python | c.auth.send_sms(**input) |
| Java | c.auth.sendSms(input) |
| Go | c.Auth.SendSms(ctx, input, &result) |
| PHP | $c->auth->sendSms($input) |
输入:SmsSendInput。 字段放在 JSON Body 中。
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
phone | 是 | string | 大陆手机号,可带 +86 |
scene | 否 | "login" | "bind" | undefined | 验证码场景;控制台登录使用 login |
captchaTicket | 否 | string | undefined | 验证码组件 ticket |
captchaRandstr | 否 | string | undefined | 验证码组件 randstr |
返回:SendCodeResult。嵌套字段见共享类型。
auth.verifySms
短信登录。
POST /v1/auth/sms/verify
鉴权:公开接口。
| 语言 | 调用 |
|---|---|
| Node.js | c.auth.verifySms(input) |
| Python | c.auth.verify_sms(**input) |
| Java | c.auth.verifySms(input) |
| Go | c.Auth.VerifySms(ctx, input, &result) |
| PHP | $c->auth->verifySms($input) |
输入:SmsVerifyInput。 字段放在 JSON Body 中。
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
code | 是 | string | 验证码或 OAuth 授权码 |
phone | 是 | string | 大陆手机号,可带 +86 |
scene | 否 | "login" | "bind" | undefined | 验证码场景;控制台登录使用 login |
captchaTicket | 否 | string | undefined | 验证码组件 ticket |
captchaRandstr | 否 | string | undefined | 验证码组件 randstr |
返回:AuthSession。嵌套字段见共享类型。
auth.sendEmail
发送邮箱验证码。
POST /v1/auth/email/send
鉴权:公开接口。
| 语言 | 调用 |
|---|---|
| Node.js | c.auth.sendEmail(input) |
| Python | c.auth.send_email(**input) |
| Java | c.auth.sendEmail(input) |
| Go | c.Auth.SendEmail(ctx, input, &result) |
| PHP | $c->auth->sendEmail($input) |
输入:EmailSendInput。 字段放在 JSON Body 中。
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
email | 是 | string | 电子邮箱地址 |
scene | 否 | "login" | "bind" | undefined | 验证码场景;控制台登录使用 login |
返回:SendCodeResult。嵌套字段见共享类型。
auth.verifyEmail
邮箱登录。
POST /v1/auth/email/verify
鉴权:公开接口。
| 语言 | 调用 |
|---|---|
| Node.js | c.auth.verifyEmail(input) |
| Python | c.auth.verify_email(**input) |
| Java | c.auth.verifyEmail(input) |
| Go | c.Auth.VerifyEmail(ctx, input, &result) |
| PHP | $c->auth->verifyEmail($input) |
输入:EmailVerifyInput。 字段放在 JSON Body 中。
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
code | 是 | string | 验证码或 OAuth 授权码 |
email | 是 | string | 电子邮箱地址 |
scene | 否 | "login" | "bind" | undefined | 验证码场景;控制台登录使用 login |
返回:AuthSession。嵌套字段见共享类型。
auth.googleAuthorize
Google 授权地址。
GET /v1/auth/google/authorize
鉴权:公开接口。
| 语言 | 调用 |
|---|---|
| Node.js | c.auth.googleAuthorize(input) |
| Python | c.auth.google_authorize(**input) |
| Java | c.auth.googleAuthorize(input) |
| Go | c.Auth.GoogleAuthorize(ctx, input, &result) |
| PHP | $c->auth->googleAuthorize($input) |
输入:OAuthAuthorizeInput。 字段放在 URL 查询参数中。
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
redirectUri | 是 | string | OAuth 回调 URL;授权和换票使用相同值 |
state | 否 | string | undefined | OAuth 状态值 |
返回:GoogleAuthorizeResult。嵌套字段见共享类型。
auth.googleCallback
Google 授权换票。
POST /v1/auth/google/callback
鉴权:公开接口。
| 语言 | 调用 |
|---|---|
| Node.js | c.auth.googleCallback(input) |
| Python | c.auth.google_callback(**input) |
| Java | c.auth.googleCallback(input) |
| Go | c.Auth.GoogleCallback(ctx, input, &result) |
| PHP | $c->auth->googleCallback($input) |
输入:GoogleCallbackPayload。 字段放在 JSON Body 中。
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
code | 是 | string | 验证码或 OAuth 授权码 |
state | 是 | string | OAuth 状态值 |
redirectUri | 是 | string | OAuth 回调 URL;授权和换票使用相同值 |
返回:AuthSession。嵌套字段见共享类型。
auth.googleToken
Google ID Token 登录。
POST /v1/auth/google/token
鉴权:公开接口。
| 语言 | 调用 |
|---|---|
| Node.js | c.auth.googleToken(input) |
| Python | c.auth.google_token(**input) |
| Java | c.auth.googleToken(input) |
| Go | c.Auth.GoogleToken(ctx, input, &result) |
| PHP | $c->auth->googleToken($input) |
输入:GoogleTokenInput。 字段放在 JSON Body 中。
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
idToken | 是 | string | Google Identity Services 返回的 ID Token |
返回:AuthSession。嵌套字段见共享类型。
auth.wechatAuthorize
微信授权地址。
GET /v1/auth/wechat/authorize
鉴权:公开接口。
| 语言 | 调用 |
|---|---|
| Node.js | c.auth.wechatAuthorize(input) |
| Python | c.auth.wechat_authorize(**input) |
| Java | c.auth.wechatAuthorize(input) |
| Go | c.Auth.WechatAuthorize(ctx, input, &result) |
| PHP | $c->auth->wechatAuthorize($input) |
输入:OAuthAuthorizeInput。 字段放在 URL 查询参数中。
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
redirectUri | 是 | string | OAuth 回调 URL;授权和换票使用相同值 |
state | 否 | string | undefined | OAuth 状态值 |
返回:GoogleAuthorizeResult。嵌套字段见共享类型。
auth.wechatCallback
微信授权换票。
POST /v1/auth/wechat/callback
鉴权:公开接口。
| 语言 | 调用 |
|---|---|
| Node.js | c.auth.wechatCallback(input) |
| Python | c.auth.wechat_callback(**input) |
| Java | c.auth.wechatCallback(input) |
| Go | c.Auth.WechatCallback(ctx, input, &result) |
| PHP | $c->auth->wechatCallback($input) |
输入:GoogleCallbackPayload。 字段放在 JSON Body 中。
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
code | 是 | string | 验证码或 OAuth 授权码 |
state | 是 | string | OAuth 状态值 |
redirectUri | 是 | string | OAuth 回调 URL;授权和换票使用相同值 |
返回:WechatCallbackResult。嵌套字段见共享类型。
auth.sendWechatBindPhone
微信登录绑定手机号发码。
POST /v1/auth/wechat/bind-phone/send
鉴权:公开接口。
| 语言 | 调用 |
|---|---|
| Node.js | c.auth.sendWechatBindPhone(input) |
| Python | c.auth.send_wechat_bind_phone(**input) |
| Java | c.auth.sendWechatBindPhone(input) |
| Go | c.Auth.SendWechatBindPhone(ctx, input, &result) |
| PHP | $c->auth->sendWechatBindPhone($input) |
输入:WechatBindPhoneSendInput。 字段放在 JSON Body 中。
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
bindTicket | 是 | string | 微信回调返回的一次性绑定凭证 |
phone | 是 | string | 大陆手机号,可带 +86 |
captchaTicket | 否 | string | undefined | 验证码组件 ticket |
captchaRandstr | 否 | string | undefined | 验证码组件 randstr |
返回:SendCodeResult。嵌套字段见共享类型。
auth.verifyWechatBindPhone
微信登录绑定手机号验证。
POST /v1/auth/wechat/bind-phone/verify
鉴权:公开接口。
| 语言 | 调用 |
|---|---|
| Node.js | c.auth.verifyWechatBindPhone(input) |
| Python | c.auth.verify_wechat_bind_phone(**input) |
| Java | c.auth.verifyWechatBindPhone(input) |
| Go | c.Auth.VerifyWechatBindPhone(ctx, input, &result) |
| PHP | $c->auth->verifyWechatBindPhone($input) |
输入:WechatBindPhoneVerifyInput。 字段放在 JSON Body 中。
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
code | 是 | string | 验证码或 OAuth 授权码 |
bindTicket | 是 | string | 微信回调返回的一次性绑定凭证 |
phone | 是 | string | 大陆手机号,可带 +86 |
captchaTicket | 否 | string | undefined | 验证码组件 ticket |
captchaRandstr | 否 | string | undefined | 验证码组件 randstr |
返回:AuthSession。嵌套字段见共享类型。
auth.sendBindPhone
登录账号绑定手机号发码。
POST /v1/auth/phone/bind/send
鉴权:租户 Bearer Token。
| 语言 | 调用 |
|---|---|
| Node.js | c.auth.sendBindPhone(input) |
| Python | c.auth.send_bind_phone(**input) |
| Java | c.auth.sendBindPhone(input) |
| Go | c.Auth.SendBindPhone(ctx, input, &result) |
| PHP | $c->auth->sendBindPhone($input) |
输入:BindPhoneSendInput。 字段放在 JSON Body 中。
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
phone | 是 | string | 大陆手机号,可带 +86 |
captchaTicket | 否 | string | undefined | 验证码组件 ticket |
captchaRandstr | 否 | string | undefined | 验证码组件 randstr |
返回:SendCodeResult。嵌套字段见共享类型。
auth.verifyBindPhone
登录账号绑定手机号。
POST /v1/auth/phone/bind/verify
鉴权:租户 Bearer Token。
| 语言 | 调用 |
|---|---|
| Node.js | c.auth.verifyBindPhone(input) |
| Python | c.auth.verify_bind_phone(**input) |
| Java | c.auth.verifyBindPhone(input) |
| Go | c.Auth.VerifyBindPhone(ctx, input, &result) |
| PHP | $c->auth->verifyBindPhone($input) |
输入:PhoneVerifyInput。 字段放在 JSON Body 中。
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
phone | 是 | string | 大陆手机号,可带 +86 |
code | 是 | string | 验证码或 OAuth 授权码 |
captchaTicket | 否 | string | undefined | 验证码组件 ticket |
captchaRandstr | 否 | string | undefined | 验证码组件 randstr |
返回:AuthUser。嵌套字段见共享类型。
auth.wechatBindAuthorize
账号绑定微信授权地址。
GET /v1/auth/wechat/bind/authorize
鉴权:租户 Bearer Token。
| 语言 | 调用 |
|---|---|
| Node.js | c.auth.wechatBindAuthorize(input) |
| Python | c.auth.wechat_bind_authorize(**input) |
| Java | c.auth.wechatBindAuthorize(input) |
| Go | c.Auth.WechatBindAuthorize(ctx, input, &result) |
| PHP | $c->auth->wechatBindAuthorize($input) |
输入:OAuthAuthorizeInput。 字段放在 URL 查询参数中。
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
redirectUri | 是 | string | OAuth 回调 URL;授权和换票使用相同值 |
state | 否 | string | undefined | OAuth 状态值 |
返回:GoogleAuthorizeResult。嵌套字段见共享类型。
auth.wechatBindCallback
账号绑定微信换票。
POST /v1/auth/wechat/bind/callback
鉴权:租户 Bearer Token。
| 语言 | 调用 |
|---|---|
| Node.js | c.auth.wechatBindCallback(input) |
| Python | c.auth.wechat_bind_callback(**input) |
| Java | c.auth.wechatBindCallback(input) |
| Go | c.Auth.WechatBindCallback(ctx, input, &result) |
| PHP | $c->auth->wechatBindCallback($input) |
输入:GoogleCallbackPayload。 字段放在 JSON Body 中。
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
code | 是 | string | 验证码或 OAuth 授权码 |
state | 是 | string | OAuth 状态值 |
redirectUri | 是 | string | OAuth 回调 URL;授权和换票使用相同值 |
返回:AuthUser。嵌套字段见共享类型。
auth.refresh
刷新租户会话。
POST /v1/auth/token/refresh
鉴权:公开接口。
| 语言 | 调用 |
|---|---|
| Node.js | c.auth.refresh(input) |
| Python | c.auth.refresh(**input) |
| Java | c.auth.refresh(input) |
| Go | c.Auth.Refresh(ctx, input, &result) |
| PHP | $c->auth->refresh($input) |
输入:RefreshInput。 字段放在 JSON Body 中。
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
refreshToken | 是 | string | 租户刷新令牌 |
返回:AuthSession。嵌套字段见共享类型。
auth.logout
退出租户会话。
POST /v1/auth/logout
鉴权:公开接口。
| 语言 | 调用 |
|---|---|
| Node.js | c.auth.logout(input) |
| Python | c.auth.logout(**input) |
| Java | c.auth.logout(input) |
| Go | c.Auth.Logout(ctx, input, &result) |
| PHP | $c->auth->logout($input) |
输入:RefreshInput。 字段放在 JSON Body 中。
| 字段 | 必填 | 类型 | 说明 |
|---|---|---|---|
refreshToken | 是 | string | 租户刷新令牌 |
返回:LogoutResult。嵌套字段见共享类型。
auth.me
当前登录账号。
GET /v1/auth/me
鉴权:租户 Bearer Token。
| 语言 | 调用 |
|---|---|
| Node.js | c.auth.me() |
| Python | c.auth.me() |
| Java | c.auth.me() |
| Go | c.Auth.Me(ctx, &result) |
| PHP | $c->auth->me() |
无请求字段。
返回:CurrentUserResult。嵌套字段见共享类型。