# 第三方登录
# 1.平台登录跳转地址
微信登录链接地址:https://open.weixin.qq.com/connect/qrconnect?appid=wx25a849d14dd44177&redirect_uri=${redirectUri}&response_type=code&scope=snsapi_login&state=STATE#wechat_redirect
参数redirectUri生成方式为:
encodeURIComponent('https://api.freelog.com/test/v2/thirdParty/weChat/codeHandle?returnUrl=http://console.testfreelog.com')
如果登陆完,有指定的跳转地址,自行替换上面参数returnUrl即可.
注意https://api.freelog.com/test/v2/thirdParty是测试环境使用的,正式环境改成https://api.freelog.com/v2/thirdParty即可.
1
2
3
4
5
2
3
4
5
# 2.非登录用户绑定与自动注册流程
用户扫码之后,后台会把网址重定向到前端的绑定界面.然后前端调用下面的API即可完成微信与平台账号的绑定.
1
# 调用方式: POST
# 接口地址:
https://api.freelog.com/v2/thirdParty/registerOrBind
1
# url传入参数说明:
| 参数 | 必选 | 类型及范围 | 说明 |
|---|---|---|---|
| loginName | 必选 | string | 登录名 |
| password | 必选 | string | 登录密码 |
| identityId | 必选 | string | 后端重定向到绑定页面时,会通过query的形式传递此参数 |
# 返回说明:
| 返回值字段 | 字段类型 | 字段说明 |
|---|---|---|
| [data] | bool | 是否操作成功 |
# 返回示例
{
"ret": 0,
"errCode": 0,
"errcode": 0,
"msg": "success",
"data": true
}
1
2
3
4
5
6
7
2
3
4
5
6
7
# 2.登录用户绑定微信账号
微信登录链接地址:https://open.weixin.qq.com/connect/qrconnect?appid=wx25a849d14dd44177&redirect_uri=${redirectUri}&response_type=code&scope=snsapi_login&state=${verifyLoginPasswordState}#wechat_redirect
参数redirectUri生成方式为:
encodeURIComponent('https://api.freelog.com/test/v2/thirdParty/weChat/bindHandle?returnUrl=http://user.testfreelog.com/logged/setting')
参数verifyLoginPasswordState从验证登录用户的密码接口获取.
如果登陆完,有指定的跳转地址,自行替换上面参数returnUrl即可.
注意https://api.freelog.com/test/v2/thirdParty是测试环境使用的,正式环境改成https://api.freelog.com/v2/thirdParty即可.
绑定操作后端会在处理完之后跳转到指定的地址(returnUrl),然后追加对应的参数.
type: wechat | weibo
status: 状态 1:绑定成功 2:绑定失败 3:微信号已被其他账号绑定
msg: 错误消息(如果有错误)
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
# 3.登录用户解绑第三方登录
# 调用方式: PUT
# 接口地址:
https://api.freelog.com/v2/thirdParty/unbind
1
# body传入参数说明:
| 参数 | 必选 | 类型及范围 | 说明 |
|---|---|---|---|
| thirdPartyType | 必选 | string | 第三方类型(weChat、weibo ) |
| password | 必选 | string | 登录密码 |
# 返回说明:
| 返回值字段 | 字段类型 | 字段说明 |
|---|---|---|
| [data] | bool | 是否操作成功 |
# 返回示例
{
"ret": 0,
"errCode": 0,
"errcode": 0,
"msg": "success",
"data": true
}
1
2
3
4
5
6
7
2
3
4
5
6
7
# 4.查询登录用户已绑定的第三方信息
# 调用方式: GET
# 接口地址:
https://api.freelog.com/v2/thirdParty/list
1
# 返回说明:
| 返回值字段 | 字段类型 | 字段说明 |
|---|---|---|
| userId | int | 当前登录用户ID |
| thirdPartyType | string | 已绑定的第三方类型(weChat,weibo) |
# 返回示例
{
"ret": 0,
"errCode": 0,
"errcode": 0,
"msg": "success",
"data": [{
"userId": 50017,
"thirdPartyType": "weChat"
}]
}
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
← 绑定或换绑手机号和邮箱 获取图片验证码 →