From af7048a82392ad944632d801f2e5ccd028bd147e Mon Sep 17 00:00:00 2001 From: Womsxd <45663319+Womsxd@users.noreply.github.com> Date: Fri, 1 Sep 2023 20:16:37 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=89=AB=E7=A0=81=E7=99=BB=E5=85=A5=20?= =?UTF-8?q?=E6=9B=B4=E5=90=8D=E4=B8=BA=20=E6=89=AB=E7=A0=81=E8=8E=B7?= =?UTF-8?q?=E5=8F=96GameToken?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- hoyolab/login/{qrcode.md => qrcode_hk4e.md} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename hoyolab/login/{qrcode.md => qrcode_hk4e.md} (98%) diff --git a/README.md b/README.md index 9383ebe..ba0db61 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ - [ ] [登录](hoyolab/login) - [x] [密码登录](hoyolab/login/password.md) - [x] [验证码登录](hoyolab/login/sms.md) - - [x] [扫码登录](hoyolab/login/qrcode.md) + - [x] [扫码获取GameToken](hoyolab/login/qrcode_hk4e.md) - [ ] [论坛](hoyolab/forum) - [ ] [基本信息](hoyolab/forum/info.md) - [ ] [文章](hoyolab/article) diff --git a/hoyolab/login/qrcode.md b/hoyolab/login/qrcode_hk4e.md similarity index 98% rename from hoyolab/login/qrcode.md rename to hoyolab/login/qrcode_hk4e.md index 6b7661a..8f52935 100644 --- a/hoyolab/login/qrcode.md +++ b/hoyolab/login/qrcode_hk4e.md @@ -1,4 +1,4 @@ -# 米游社扫码登录 +# 米游社扫码获取GameToken - [扫码登录](#扫码登录) - [操作步骤](#qrcode-step) From 0a69e31bfdd2521b05d49e4975371d8fec0f2639 Mon Sep 17 00:00:00 2001 From: Womsxd <45663319+Womsxd@users.noreply.github.com> Date: Fri, 1 Sep 2023 20:18:13 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=8A=A0=E5=85=A5=20=E6=89=AB=E7=A0=81?= =?UTF-8?q?=E7=99=BB=E5=85=A5=E7=B1=B3=E6=B8=B8=E7=A4=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + hoyolab/login/qrcode_hoyolab.md | 182 ++++++++++++++++++++++++++++++++ 2 files changed, 183 insertions(+) create mode 100644 hoyolab/login/qrcode_hoyolab.md diff --git a/README.md b/README.md index ba0db61..fdedc53 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/hoyolab/login/qrcode_hoyolab.md b/hoyolab/login/qrcode_hoyolab.md new file mode 100644 index 0000000..2ca21f9 --- /dev/null +++ b/hoyolab/login/qrcode_hoyolab.md @@ -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 | 查询扫码状态的参数 | | + +
+查看示例 + +```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" + } +} +``` + +
+ +### 查询二维码扫描状态 + +**国服:** + +_请求方式: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 | 返回码
-3001 Header头缺少参数
-3501 二维码已过期
-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 | 二维码状态
Created 未扫描
Scanned 已扫描
Confirmed 已确认 | | +|tokens|list||一直为空| +|user_info|obj|登入用户信息|确认之前为空| + +
+查看示例 + +```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 + } +} +``` +