跳到主要内容

账号与会话

控制台客户端配置 · 返回值与共享类型

租户会话由登录接口签发。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.jsc.auth.methods()
Pythonc.auth.methods()
Javac.auth.methods()
Goc.Auth.Methods(ctx, &result)
PHP$c->auth->methods()

无请求字段。

返回:AuthMethods。嵌套字段见共享类型。

auth.sendSms​

发送短信验证码。

POST /v1/auth/sms/send

鉴权:公开接口。

语言调用
Node.jsc.auth.sendSms(input)
Pythonc.auth.send_sms(**input)
Javac.auth.sendSms(input)
Goc.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.jsc.auth.verifySms(input)
Pythonc.auth.verify_sms(**input)
Javac.auth.verifySms(input)
Goc.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.jsc.auth.sendEmail(input)
Pythonc.auth.send_email(**input)
Javac.auth.sendEmail(input)
Goc.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.jsc.auth.verifyEmail(input)
Pythonc.auth.verify_email(**input)
Javac.auth.verifyEmail(input)
Goc.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.jsc.auth.googleAuthorize(input)
Pythonc.auth.google_authorize(**input)
Javac.auth.googleAuthorize(input)
Goc.Auth.GoogleAuthorize(ctx, input, &result)
PHP$c->auth->googleAuthorize($input)

输入:OAuthAuthorizeInput。 字段放在 URL 查询参数中。

字段必填类型说明
redirectUri是stringOAuth 回调 URL;授权和换票使用相同值
state否string | undefinedOAuth 状态值

返回:GoogleAuthorizeResult。嵌套字段见共享类型。

auth.googleCallback​

Google 授权换票。

POST /v1/auth/google/callback

鉴权:公开接口。

语言调用
Node.jsc.auth.googleCallback(input)
Pythonc.auth.google_callback(**input)
Javac.auth.googleCallback(input)
Goc.Auth.GoogleCallback(ctx, input, &result)
PHP$c->auth->googleCallback($input)

输入:GoogleCallbackPayload。 字段放在 JSON Body 中。

字段必填类型说明
code是string验证码或 OAuth 授权码
state是stringOAuth 状态值
redirectUri是stringOAuth 回调 URL;授权和换票使用相同值

返回:AuthSession。嵌套字段见共享类型。

auth.googleToken​

Google ID Token 登录。

POST /v1/auth/google/token

鉴权:公开接口。

语言调用
Node.jsc.auth.googleToken(input)
Pythonc.auth.google_token(**input)
Javac.auth.googleToken(input)
Goc.Auth.GoogleToken(ctx, input, &result)
PHP$c->auth->googleToken($input)

输入:GoogleTokenInput。 字段放在 JSON Body 中。

字段必填类型说明
idToken是stringGoogle Identity Services 返回的 ID Token

返回:AuthSession。嵌套字段见共享类型。

auth.wechatAuthorize​

微信授权地址。

GET /v1/auth/wechat/authorize

鉴权:公开接口。

语言调用
Node.jsc.auth.wechatAuthorize(input)
Pythonc.auth.wechat_authorize(**input)
Javac.auth.wechatAuthorize(input)
Goc.Auth.WechatAuthorize(ctx, input, &result)
PHP$c->auth->wechatAuthorize($input)

输入:OAuthAuthorizeInput。 字段放在 URL 查询参数中。

字段必填类型说明
redirectUri是stringOAuth 回调 URL;授权和换票使用相同值
state否string | undefinedOAuth 状态值

返回:GoogleAuthorizeResult。嵌套字段见共享类型。

auth.wechatCallback​

微信授权换票。

POST /v1/auth/wechat/callback

鉴权:公开接口。

语言调用
Node.jsc.auth.wechatCallback(input)
Pythonc.auth.wechat_callback(**input)
Javac.auth.wechatCallback(input)
Goc.Auth.WechatCallback(ctx, input, &result)
PHP$c->auth->wechatCallback($input)

输入:GoogleCallbackPayload。 字段放在 JSON Body 中。

字段必填类型说明
code是string验证码或 OAuth 授权码
state是stringOAuth 状态值
redirectUri是stringOAuth 回调 URL;授权和换票使用相同值

返回:WechatCallbackResult。嵌套字段见共享类型。

auth.sendWechatBindPhone​

微信登录绑定手机号发码。

POST /v1/auth/wechat/bind-phone/send

鉴权:公开接口。

语言调用
Node.jsc.auth.sendWechatBindPhone(input)
Pythonc.auth.send_wechat_bind_phone(**input)
Javac.auth.sendWechatBindPhone(input)
Goc.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.jsc.auth.verifyWechatBindPhone(input)
Pythonc.auth.verify_wechat_bind_phone(**input)
Javac.auth.verifyWechatBindPhone(input)
Goc.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.jsc.auth.sendBindPhone(input)
Pythonc.auth.send_bind_phone(**input)
Javac.auth.sendBindPhone(input)
Goc.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.jsc.auth.verifyBindPhone(input)
Pythonc.auth.verify_bind_phone(**input)
Javac.auth.verifyBindPhone(input)
Goc.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.jsc.auth.wechatBindAuthorize(input)
Pythonc.auth.wechat_bind_authorize(**input)
Javac.auth.wechatBindAuthorize(input)
Goc.Auth.WechatBindAuthorize(ctx, input, &result)
PHP$c->auth->wechatBindAuthorize($input)

输入:OAuthAuthorizeInput。 字段放在 URL 查询参数中。

字段必填类型说明
redirectUri是stringOAuth 回调 URL;授权和换票使用相同值
state否string | undefinedOAuth 状态值

返回:GoogleAuthorizeResult。嵌套字段见共享类型。

auth.wechatBindCallback​

账号绑定微信换票。

POST /v1/auth/wechat/bind/callback

鉴权:租户 Bearer Token。

语言调用
Node.jsc.auth.wechatBindCallback(input)
Pythonc.auth.wechat_bind_callback(**input)
Javac.auth.wechatBindCallback(input)
Goc.Auth.WechatBindCallback(ctx, input, &result)
PHP$c->auth->wechatBindCallback($input)

输入:GoogleCallbackPayload。 字段放在 JSON Body 中。

字段必填类型说明
code是string验证码或 OAuth 授权码
state是stringOAuth 状态值
redirectUri是stringOAuth 回调 URL;授权和换票使用相同值

返回:AuthUser。嵌套字段见共享类型。

auth.refresh​

刷新租户会话。

POST /v1/auth/token/refresh

鉴权:公开接口。

语言调用
Node.jsc.auth.refresh(input)
Pythonc.auth.refresh(**input)
Javac.auth.refresh(input)
Goc.Auth.Refresh(ctx, input, &result)
PHP$c->auth->refresh($input)

输入:RefreshInput。 字段放在 JSON Body 中。

字段必填类型说明
refreshToken是string租户刷新令牌

返回:AuthSession。嵌套字段见共享类型。

auth.logout​

退出租户会话。

POST /v1/auth/logout

鉴权:公开接口。

语言调用
Node.jsc.auth.logout(input)
Pythonc.auth.logout(**input)
Javac.auth.logout(input)
Goc.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.jsc.auth.me()
Pythonc.auth.me()
Javac.auth.me()
Goc.Auth.Me(ctx, &result)
PHP$c->auth->me()

无请求字段。

返回:CurrentUserResult。嵌套字段见共享类型。