[关闭]
@fuyb1986 2017-05-08T13:38:32.000000Z 字数 1119 阅读 650

OAuth 登录

金色童年


登录

Method and URL Structure

Method Resource URL
POST /account/o/login/

Request Data

Name Decription Required
code 第三方平台返回的 code True
app 第三方平台的名字: wechat, weibo, qq True

Request Data

  1. {
  2. "code": "1234567890abcdef",
  3. "app": "wechat",
  4. }

Reponse

Name Decription
app 第三方平台的名字: wechat, weibo, qq
openid 第三方平台的 openid
token 身份验证 token
username openid 绑定的用户名

Response Data

  1. {
  2. "username": "13212345678",
  3. "token": "ffdf2561f854f6c888e10105d69ec364fef6c348",
  4. "app": "wechat",
  5. "openid": "888e10105d69e"
  6. }

登录时没有返回 username 或 token,需要执行绑定操作

绑定前请求验证码

Method and URL Structure

Method Resource URL
GET /account/o/bind_request/

Request Parameters

Name Decription Required
username 绑定的手机号 True

Reponse

这个参数表示是不是需要注册,
请求绑定接口时带上这个参数

Name Description
signup 没有注册的用户返回: true

Response Data

  1. {
  2. "signup": "true"
  3. }

绑定

Method and URL Structure

Method Resource URL
POST /account/o/bind/

Request Parameters

Name Decription Required
username 绑定的手机号 True
openid 第三方平台 openid True
signup 是否同时注册 True
verification_code 验证码 True
password 注册时带上密码

Reponse

Name Decription
app 第三方平台的名字: wechat, weibo, qq
openid 第三方平台的 openid
token 身份验证 token
username openid 绑定的用户名

Response Data

  1. {
  2. "username": "13212345678",
  3. "token": "ffdf2561f854f6c888e10105d69ec364fef6c348",
  4. "app": "wechat",
  5. "openid": "888e10105d69e"
  6. }
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注