mirror of
https://github.com/PaiGramTeam/mihoyo-api-collect.git
synced 2024-11-25 09:37:27 +00:00
加入 扫码登入米游社
This commit is contained in:
parent
af7048a823
commit
0a69e31bfd
@ -80,6 +80,7 @@
|
||||
- [x] [密码登录](hoyolab/login/password.md)
|
||||
- [x] [验证码登录](hoyolab/login/sms.md)
|
||||
- [x] [扫码获取GameToken](hoyolab/login/qrcode_hk4e.md)
|
||||
- [x] [扫码登入米游社](hoyolab/login//qrcode_hoyolab.md)
|
||||
- [ ] [论坛](hoyolab/forum)
|
||||
- [ ] [基本信息](hoyolab/forum/info.md)
|
||||
- [ ] [文章](hoyolab/article)
|
||||
|
182
hoyolab/login/qrcode_hoyolab.md
Normal file
182
hoyolab/login/qrcode_hoyolab.md
Normal file
@ -0,0 +1,182 @@
|
||||
# 米游社扫码登入
|
||||
|
||||
- [扫码登录](#扫码登录)
|
||||
- [操作步骤](#操作步骤)
|
||||
- [生成二维码](#生成二维码)
|
||||
- [查询二维码扫描状态](#查询二维码扫描状态)
|
||||
|
||||
---
|
||||
|
||||
## 扫码登录
|
||||
|
||||
### 操作步骤
|
||||
|
||||
1. [生成二维码](#生成二维码),记录返回`data`对象的`url`,和`data`对象的`ticket`字段(下称`ticket`)。
|
||||
2. 生成二维码供用户扫描。
|
||||
3. 不断[查询二维码扫描状态](#查询二维码扫描状态)。在用户扫描并确认登录后,获取`header`头里面全部的`Set-Cookie`。
|
||||
|
||||
### 生成二维码
|
||||
|
||||
**国服:**
|
||||
|
||||
_请求方式:POST_
|
||||
|
||||
> _需要特定请求头_
|
||||
>
|
||||
> `X-Rpc-App_id`:`bll8iq97cem8`
|
||||
>
|
||||
> `X-Rpc-Device_id`:一个uuidv4
|
||||
|
||||
`https://passport-api.miyoushe.com/account/ma-cn-passport/web/createQRLogin`
|
||||
|
||||
**JSON 返回:**
|
||||
|
||||
根对象:
|
||||
|
||||
| 字段 | 类型 | 内容 | 备注 |
|
||||
| ------- | ---- | ---------------- | ---- |
|
||||
| retcode | num | 返回码 | -3001 Header头缺少参数 |
|
||||
| message | str | 返回消息 | |
|
||||
| data | obj | 二维码指向的 URL | |
|
||||
|
||||
`data`对象:
|
||||
|
||||
| 字段 | 类型 | 内容 | 备注 |
|
||||
| ------ | ---- | ------------------ | ------------------- |
|
||||
| url | str | 二维码指向的 URL | 使用了 Unicode 转义 |
|
||||
| ticket | str | 查询扫码状态的参数 | |
|
||||
|
||||
<details>
|
||||
<summary>查看示例</summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"retcode": 0,
|
||||
"message": "OK",
|
||||
"data": {
|
||||
"url": "https://user.mihoyo.com/login-platform/mobile.html?expire=1693555708\u0026tk=e8a6448c-6596-461c-884a-98fe84bd675b\u0026token_types=4#/login/qr",
|
||||
"ticket": "e8a6448c-6596-461c-884a-98fe84bd675b"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
### 查询二维码扫描状态
|
||||
|
||||
**国服:**
|
||||
|
||||
_请求方式:POST_
|
||||
|
||||
> _需要特定请求头_
|
||||
>
|
||||
> `X-Rpc-App_id`:`bll8iq97cem8`
|
||||
>
|
||||
> `X-Rpc-Device_id`:一个uuidv4
|
||||
|
||||
`https://passport-api.miyoushe.com/account/ma-cn-passport/web/queryQRLoginStatus`
|
||||
|
||||
**JSON请求:**
|
||||
|
||||
| 字段 | 类型 | 内容 | 备注 |
|
||||
| ---- | ---- | ---- | ---- |
|
||||
| ticket | str | 生成二维码时从返回的json中,`data.ticket`字段的值 | |
|
||||
|
||||
**JSON返回:**
|
||||
|
||||
根对象:
|
||||
|
||||
| 字段 | 类型 | 内容 | 备注 |
|
||||
| ---- | ---- | ---- | ---- |
|
||||
| retcode | num | 返回码<br>-3001 Header头缺少参数<br>-3501 二维码已过期<br>-3505 用户取消扫码 | |
|
||||
| message | str | 返回消息 | |
|
||||
| data | obj | 二维码状态 | |
|
||||
|
||||
`data`对象:
|
||||
|
||||
| 字段 | 类型 | 内容 | 备注 |
|
||||
| ---- | ---- | ---- | ---- |
|
||||
|app_id|str|请求的app_id| |
|
||||
|client_type|num|客户端类型||
|
||||
|created_at|str|创建时间戳||
|
||||
|need_realperson|bool|||
|
||||
|realname_info|obj||确认之前为空|
|
||||
|scanned_at|str|扫码时间戳|扫描之前为空|
|
||||
| status | str | 二维码状态<br>Created 未扫描<br>Scanned 已扫描<br>Confirmed 已确认 | |
|
||||
|tokens|list||一直为空|
|
||||
|user_info|obj|登入用户信息|确认之前为空|
|
||||
|
||||
<details>
|
||||
<summary>查看示例</summary>
|
||||
|
||||
```json
|
||||
// 未扫描
|
||||
{
|
||||
"retcode": 0,
|
||||
"message": "OK",
|
||||
"data": {
|
||||
"status": "Created",
|
||||
"app_id": "bll8iq97cem8",
|
||||
"client_type": 4,
|
||||
"created_at": "1693555708",
|
||||
"scanned_at": "0",
|
||||
"tokens": [],
|
||||
"user_info": null,
|
||||
"realname_info": null,
|
||||
"need_realperson": false
|
||||
}
|
||||
}
|
||||
|
||||
// 已扫描
|
||||
{
|
||||
"retcode": 0,
|
||||
"message": "OK",
|
||||
"data": {
|
||||
"status": "Scanned",
|
||||
"app_id": "bll8iq97cem8",
|
||||
"client_type": 4,
|
||||
"created_at": "1693555708",
|
||||
"scanned_at": "1693555708",
|
||||
"tokens": [],
|
||||
"user_info": null,
|
||||
"realname_info": null,
|
||||
"need_realperson": false
|
||||
}
|
||||
}
|
||||
|
||||
// 已过期
|
||||
{
|
||||
"data": null,
|
||||
"message": "二维码已失效,请刷新后重新扫描",
|
||||
"retcode": -3501
|
||||
}
|
||||
|
||||
//取消扫码
|
||||
{
|
||||
"data": null,
|
||||
"message": "扫码登录已取消,重新生成二维码",
|
||||
"retcode": -3505
|
||||
}
|
||||
|
||||
// 已确认
|
||||
{
|
||||
"retcode": 0,
|
||||
"message": "OK",
|
||||
"data": {
|
||||
"status": "Confirmed",
|
||||
"app_id": "bll8iq97cem8",
|
||||
"client_type": 4,
|
||||
"created_at": "1693555708",
|
||||
"scanned_at": "1693555708",
|
||||
"tokens": [],
|
||||
"user_info": {"aid":"xxxx","mid":"xxxx".....},
|
||||
"realname_info": {
|
||||
"required": false,
|
||||
"action_type": "",
|
||||
"action_ticket": ""
|
||||
},
|
||||
"need_realperson": false
|
||||
}
|
||||
}
|
||||
```
|
||||
</details>
|
Loading…
Reference in New Issue
Block a user