ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
# 第三方账号 >[info] 第三方账号登录,如(微信,QQ一键登录等); ## 调用绑定 请求地址:[https://你的域名/api/oauth/{way}](https://xn--6qqv7i2xdt95b/api/oauth/%7Bway%7D) 地址参数: | 字段 | 名称 | 说明 | | --- | --- | --- | | alias | 绑定方式 | 第三方账号别名 alias | 请求方法:GET 请求数据: | 字段 | 名称 | 说明 | | --- | --- | --- | | | | | 注:根据不同接口提交请求数据; 返回数据: | 字段 | 名称 | 说明 | | --- | --- | --- | | | | | 注:根据不同接口返回数据; 请求示例: ``` request({ url: "https://demo.bottlecms.com/api/oauth/wxapp", method: "GET", data:{ code:"003ukm000uVtLL1LM7200AWxeQ0ukm0x", iv:"le7q13cz0nBIUH3LAza55Q%3D%3D", encryptedData:"Cu6xd3EqfTbbGx85fabFyMr38ezHmtJY2TyC7xh4fZQ91T1H0X09KhoMsGbuvMb498E8%2B2591kQ17c4UdviGllBVC7nrjLlxWdjNVbkinFdJjD%2FM6Ilw3jzWTud30RYbox6aCs9r%2Bzygkl77KX%2BnsjeNOwCbe7GzRYo0oGV2w%2BOYa4q5hW4Ro6TBJg%2FIsYERTXVU8Im04z8BsmdzHxtFz1uTuk%2Fi4T%2FIUWq4GA0JgYXwVgtioSnhnR%2ByTQnIwh8PTl56oBoN4dSDJUQHnppi7ll0fwQhiOdxoBHoXEBJ02pU5j0SZSINfWp4kKm498F2R%2FJnyd6GHGfPbF%2FJTpLN4LMiK8mpgaP%2Bv6yO8hA7%2B6oX2FKEsaKc1giCtMv8MaQI6l8KklJSoN6CrfGLxboRFcDsoL67MdhxINBfjJIpPYahRfLrNUJmC8PXij9YLyz5" } success: (res) => { if(res.code==200){ //返回成功 console.log(res.obj); //储存用户数据 } } }); ``` 返回示例: ``` { "success":true, "code":200, "msg":"登录成功", "obj":{ "user_id": 542, "username": "wxapp_05511039153", "user_type": 0, "user_eid": "f4c80d755a9a1037d7b69993c341bcf9", "access_token": "$2y$10$FtpTsZBtCwRYizxeI7.C1eNFXOcSF8WpyyG0TnRHBfXzCCTCusp6u", "access_token_timeout": "2021-05-20 16:01:31", "user_group_id": "2", "user_group_action": "karma,nearby,single_index,single_show,voice_index,video_index,manage_like,activity_index,activity_show,appointment_index,appointment_show,moment_index,moment_create,topic_index,topic_show,post_index,post_create,groupchat_index,groupchat_show" } } ``` ## 绑定账号 请求地址:[https://你的域名/api/oauth/{alias}/bind](https://xn--6qqv7i2xdt95b/api/oauth/%7Balias%7D/bind) 地址参数: | 字段 | 名称 | 说明 | | --- | --- | --- | | alias | 绑定方式 | 第三方账号别名 alias[](https://xn--6qqv7i2xdt95b/api/login/sendsmscode) | 请求方法:POST 请求数据: | 字段 | 名称 | 说明 | | --- | --- | --- | | bind\_way | 绑定方式(登录/注册) | 可选:register 或 login | | bind\_way\_item | 登录/注册方式 | 可选:mobile 或 email 或password(仅支持登录) | | openid | 识别ID | 第三方账号用户唯一识别ID | | unionid | 公共识别ID | 第三方账号用户公共识别ID | | username | 用户名 | (mobile, email,password) 三选一 | | password | 密码 | (mobile, email,password) 三选一 | | mobile | 手机号 | (mobile, email,password) 三选一 | | smsyzm | 短信验证码 | (mobile, email,password) 三选一 | | email | 邮箱 | (mobile, email,password) 三选一 | | emailyzm | 邮箱验证码 | (mobile, email,password) 三选一 | | introducer | 介绍人 | bind\_way为register时可用 | 返回数据:参照注册/登录返回数据; 请求示例: ``` request({ url: "https://demo.bottlecms.com/api/oauth/wxapp/bind", method: "POST", data:{ bind_way:"register", bind_way_item:"mobile", mobile:"13100000001", smsyzm:"020312" }, success: (res) => { if(res.code==200){ //返回成功 console.log(res.obj); } } }); ``` 返回示例: ``` { "success":true, "code":200, "msg":"注册成功", "obj":{ "user_id": 542, "username": "wxapp_05511039153", "user_type": 0, "user_eid": "f4c80d755a9a1037d7b69993c341bcf9", "access_token": "$2y$10$FtpTsZBtCwRYizxeI7.C1eNFXOcSF8WpyyG0TnRHBfXzCCTCusp6u", "access_token_timeout": "2021-05-20 16:01:31", "user_group_id": "2", "user_group_action": "karma,nearby,single_index,single_show,voice_index,video_index,manage_like,activity_index,activity_show,appointment_index,appointment_show,moment_index,moment_create,topic_index,topic_show,post_index,post_create,groupchat_index,groupchat_show" } } ``` ## 解除绑定 请求地址:[https://你的域名/api/oauth/{alias}/release](https://xn--6qqv7i2xdt95b/api/oauth/%7Balias%7D/release) 地址参数: | 字段 | 名称 | 说明 | | --- | --- | --- | | alias | 绑定方式 | 第三方账号别名 alias[](https://xn--6qqv7i2xdt95b/api/login/sendsmscode) | 请求方法:GET 请求数据:NULL 返回数据:参照注册/登录返回数据; 请求示例: ``` request({ url: "https://demo.bottlecms.com/api/oauth/wxapp/release", method: "GET", success: (res) => { if(res.code==200){ //返回成功 console.log(res.obj); } } }); ``` 返回示例: ``` { "success":true, "code":200, "msg":"解绑成功", } ```