import{_ as t,c as o,a,b as l,d as n,e as p,w as c,r as d,o as r}from"./app-Dgsdh8A6.js";const i="/bilibili-API-collect/assets/2233login-DlOTSxTX.png",D={};function u(y,s){const e=d("RouteLink");return r(),o("div",null,[s[3]||(s[3]=a('<h1 id="二维码登录" tabindex="-1"><a class="header-anchor" href="#二维码登录"><span>二维码登录</span></a></h1><img src="'+i+`"><h2 id="扫码登录流程-伪代码" tabindex="-1"><a class="header-anchor" href="#扫码登录流程-伪代码"><span>扫码登录流程(伪代码)</span></a></h2><div class="language-python line-numbers-mode" data-highlighter="shiki" data-ext="python" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-python"><span class="line"><span style="color:#D4D4D4;">token, url = 申请二维码()</span></span>
<span class="line"><span style="color:#D4D4D4;">生成二维码(url) </span><span style="color:#6A9955;"># 等待客户端扫码</span></span>
<span class="line"><span style="color:#C586C0;">while</span><span style="color:#569CD6;"> True</span><span style="color:#D4D4D4;">:</span></span>
<span class="line"><span style="color:#D4D4D4;">    status, cookie = 扫码登录(token)</span></span>
<span class="line"><span style="color:#C586C0;">    match</span><span style="color:#D4D4D4;"> status:</span></span>
<span class="line"><span style="color:#C586C0;">        case</span><span style="color:#D4D4D4;"> 未扫描:</span></span>
<span class="line"><span style="color:#C586C0;">            continue</span></span>
<span class="line"><span style="color:#C586C0;">        case</span><span style="color:#D4D4D4;"> 二维码超时 | 二维码失效:</span></span>
<span class="line"><span style="color:#D4D4D4;">            提示(</span><span style="color:#CE9178;">&#39;二维码失效或超时&#39;</span><span style="color:#D4D4D4;">) </span><span style="color:#6A9955;"># 需要用户重新操作</span></span>
<span class="line"><span style="color:#C586C0;">            break</span></span>
<span class="line"><span style="color:#C586C0;">        case</span><span style="color:#D4D4D4;"> 已扫描未确认:</span></span>
<span class="line"><span style="color:#D4D4D4;">            提示(</span><span style="color:#CE9178;">&#39;扫描成功&#39;</span><span style="color:#D4D4D4;">)</span></span>
<span class="line"><span style="color:#C586C0;">        case</span><span style="color:#D4D4D4;"> 登录成功:</span></span>
<span class="line"><span style="color:#D4D4D4;">            提示(</span><span style="color:#CE9178;">&#39;扫描成功&#39;</span><span style="color:#D4D4D4;">)</span></span>
<span class="line"><span style="color:#D4D4D4;">            存储cookie(cookie)</span></span>
<span class="line"><span style="color:#D4D4D4;">            SSO登录页面跳转()</span></span>
<span class="line"><span style="color:#C586C0;">            break</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h2 id="web端扫码登录" tabindex="-1"><a class="header-anchor" href="#web端扫码登录"><span>web端扫码登录</span></a></h2><h3 id="申请二维码-web端" tabindex="-1"><a class="header-anchor" href="#申请二维码-web端"><span>申请二维码(web端)</span></a></h3><blockquote><p>https://passport.bilibili.com/x/passport-login/web/qrcode/generate</p></blockquote><p><em>请求方式：GET</em></p><p>密钥超时为180秒</p><p><strong>json回复：</strong></p><p>根对象：</p><table><thead><tr><th>字段</th><th>类型</th><th>内容</th><th>备注</th></tr></thead><tbody><tr><td>code</td><td>num</td><td>返回值</td><td>0：成功</td></tr><tr><td>message</td><td>str</td><td>错误信息</td><td></td></tr><tr><td>ttl</td><td>num</td><td>1</td><td></td></tr><tr><td>data</td><td>obj</td><td>信息本体</td><td></td></tr></tbody></table><p><code>data</code>对象：</p><table><thead><tr><th>字段</th><th>类型</th><th>内容</th><th>备注</th></tr></thead><tbody><tr><td>url</td><td>str</td><td>二维码内容 (登录页面 url)</td><td></td></tr><tr><td>qrcode_key</td><td>str</td><td>扫码登录秘钥</td><td>恒为32字符</td></tr></tbody></table><p><strong>示例：</strong></p><p><code>url</code>中的值生成二维码，等待手机客户端扫描，并将<code>qrcode_key</code>保存备用</p><div class="language-shell line-numbers-mode" data-highlighter="shiki" data-ext="shell" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-shell"><span class="line"><span style="color:#DCDCAA;">curl</span><span style="color:#CE9178;"> &#39;https://passport.bilibili.com/x/passport-login/web/qrcode/generate&#39;</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div></div></div><details><summary>查看响应示例：</summary><div class="language-json line-numbers-mode" data-highlighter="shiki" data-ext="json" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-json"><span class="line"><span style="color:#D4D4D4;">{</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;code&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">0</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;message&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;0&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;ttl&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">1</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;data&quot;</span><span style="color:#D4D4D4;">: {</span></span>
<span class="line"><span style="color:#9CDCFE;">        &quot;url&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;https://passport.bilibili.com/h5-app/passport/login/scan?navhide=1</span><span style="color:#D7BA7D;">\\u0026</span><span style="color:#CE9178;">qrcode_key=8587cf8106a0b863c46d6bab913537f6</span><span style="color:#D7BA7D;">\\u0026</span><span style="color:#CE9178;">from=&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">        &quot;qrcode_key&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;8587cf8106a0b863c46d6bab913537f6&quot;</span></span>
<span class="line"><span style="color:#D4D4D4;">    }</span></span>
<span class="line"><span style="color:#D4D4D4;">}</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details><h3 id="扫码登录-web端" tabindex="-1"><a class="header-anchor" href="#扫码登录-web端"><span>扫码登录(web端)</span></a></h3><blockquote><p>https://passport.bilibili.com/x/passport-login/web/qrcode/poll</p></blockquote><p><em>请求方式：GET</em></p><p><strong>url参数：</strong></p><table><thead><tr><th>参数名</th><th>类型</th><th>内容</th><th>必要性</th><th>备注</th></tr></thead><tbody><tr><td>qrcode_key</td><td>str</td><td>扫码登录秘钥</td><td>必要</td><td></td></tr></tbody></table><p>密钥超时为180秒</p><p>验证登录成功后会进行设置以下cookie项：</p><p><code>DedeUserID</code> <code>DedeUserID__ckMd5</code> <code>SESSDATA</code> <code>bili_jct</code></p><p><strong>json回复：</strong></p><p>根对象：</p><table><thead><tr><th>字段</th><th>类型</th><th>内容</th><th>备注</th></tr></thead><tbody><tr><td>code</td><td>num</td><td>返回值</td><td>0：成功</td></tr><tr><td>message</td><td>str</td><td>错误信息</td><td></td></tr><tr><td>data</td><td>obj</td><td>信息本体</td><td></td></tr></tbody></table><p>data 对象：</p><table><thead><tr><th>字段</th><th>类型</th><th>内容</th><th>备注</th></tr></thead><tbody><tr><td>url</td><td>str</td><td>游戏分站跨域登录 url</td><td>未登录为空</td></tr><tr><td>refresh_token</td><td>str</td><td>刷新<code>refresh_token</code></td><td>未登录为空</td></tr><tr><td>timestamp</td><td>num</td><td>登录时间</td><td>未登录为<code>0</code><br>时间戳 单位为毫秒</td></tr><tr><td>code</td><td>num</td><td>0：扫码登录成功<br>86038：二维码已失效<br>86090：二维码已扫码未确认<br>86101：未扫码</td><td></td></tr><tr><td>message</td><td>str</td><td>扫码状态信息</td><td></td></tr></tbody></table><p><strong>示例：</strong></p><p>使用扫描秘钥<code>c3bd5286a2b40a822f5f60e9bf3f602e</code>登录</p><div class="language-shell line-numbers-mode" data-highlighter="shiki" data-ext="shell" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-shell"><span class="line"><span style="color:#DCDCAA;">curl</span><span style="color:#569CD6;"> -G</span><span style="color:#CE9178;"> &quot;https://passport.bilibili.com/x/passport-login/web/qrcode/poll&quot;</span><span style="color:#D7BA7D;">\\</span></span>
<span class="line"><span style="color:#D4D4D4;">--data-urlencode </span><span style="color:#CE9178;">&#39;qrcode_key=c3bd5286a2b40a822f5f60e9bf3f602e&#39;</span><span style="color:#D7BA7D;"> \\</span></span>
<span class="line"><span style="color:#D4D4D4;">-c </span><span style="color:#CE9178;">&#39;cookie.txt&#39;</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>当密钥正确时但未扫描时<code>code</code>为<code>86101</code></p><details><summary>查看响应示例：</summary><div class="language-json line-numbers-mode" data-highlighter="shiki" data-ext="json" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-json"><span class="line"><span style="color:#D4D4D4;">{</span></span>
<span class="line"><span style="color:#9CDCFE;">  &quot;code&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">0</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">  &quot;message&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;0&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">  &quot;ttl&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">1</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">  &quot;data&quot;</span><span style="color:#D4D4D4;">: {</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;url&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;refresh_token&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;timestamp&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">0</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;code&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">86101</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;message&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;未扫码&quot;</span></span>
<span class="line"><span style="color:#D4D4D4;">  }</span></span>
<span class="line"><span style="color:#D4D4D4;">}</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details><p>扫描成功但手机端未确认时<code>code</code>为<code>86090</code></p><details><summary>查看响应示例：</summary><div class="language-json line-numbers-mode" data-highlighter="shiki" data-ext="json" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-json"><span class="line"><span style="color:#D4D4D4;">{</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;code&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">0</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;message&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;0&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;ttl&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">1</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;data&quot;</span><span style="color:#D4D4D4;">: {</span></span>
<span class="line"><span style="color:#9CDCFE;">        &quot;url&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">        &quot;refresh_token&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">        &quot;timestamp&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">0</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">        &quot;code&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">86090</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">        &quot;message&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;二维码已扫码未确认&quot;</span></span>
<span class="line"><span style="color:#D4D4D4;">    }</span></span>
<span class="line"><span style="color:#D4D4D4;">}</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details><p>扫描成功手机端确认登录后，<code>code</code>为<code>0</code>，并向浏览器写入cookie</p><details><summary>查看响应示例：</summary><div class="language-json line-numbers-mode" data-highlighter="shiki" data-ext="json" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-json"><span class="line"><span style="color:#D4D4D4;">{</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;code&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">0</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;message&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;0&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;ttl&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">1</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;data&quot;</span><span style="color:#D4D4D4;">: {</span></span>
<span class="line"><span style="color:#9CDCFE;">        &quot;url&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;https://passport.biligame.com/crossDomain?DedeUserID=***</span><span style="color:#D7BA7D;">\\u0026</span><span style="color:#CE9178;">DedeUserID__ckMd5=***</span><span style="color:#D7BA7D;">\\u0026</span><span style="color:#CE9178;">Expires=***</span><span style="color:#D7BA7D;">\\u0026</span><span style="color:#CE9178;">SESSDATA=***</span><span style="color:#D7BA7D;">\\u0026</span><span style="color:#CE9178;">bili_jct=***</span><span style="color:#D7BA7D;">\\u0026</span><span style="color:#CE9178;">gourl=https%3A%2F%2Fpassport.bilibili.com&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">        &quot;refresh_token&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;***&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">        &quot;timestamp&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">1662363009601</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">        &quot;code&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">0</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">        &quot;message&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;&quot;</span></span>
<span class="line"><span style="color:#D4D4D4;">    }</span></span>
<span class="line"><span style="color:#D4D4D4;">}</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details><p><strong>响应头部抓包信息：</strong></p><p>可明显看见设置了几个cookie</p><details><summary>查看响应示例：</summary><div class="language-http line-numbers-mode" data-highlighter="shiki" data-ext="http" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-http"><span class="line"><span style="color:#569CD6;">HTTP</span><span style="color:#D4D4D4;">/</span><span style="color:#B5CEA8;">1.1</span><span style="color:#B5CEA8;"> 200</span><span style="color:#CE9178;"> OK</span></span>
<span class="line"><span style="color:#569CD6;">Date:</span><span style="color:#CE9178;"> Mon, 05 Sep 2022 07:30:09 GMT</span></span>
<span class="line"><span style="color:#569CD6;">Expires:</span><span style="color:#CE9178;"> Mon, 05 Sep 2022 07:30:08 GMT</span></span>
<span class="line"><span style="color:#569CD6;">Cache-control:</span><span style="color:#CE9178;"> no-cache</span></span>
<span class="line"><span style="color:#569CD6;">Content-encoding:</span><span style="color:#CE9178;"> br</span></span>
<span class="line"><span style="color:#569CD6;">Content-type:</span><span style="color:#CE9178;"> application/json; charset=utf-8</span></span>
<span class="line"><span style="color:#569CD6;">bili-status-code:</span><span style="color:#CE9178;"> 0</span></span>
<span class="line"><span style="color:#569CD6;">bili-trace-id:</span><span style="color:#CE9178;"> 0d23fe044a6315a5</span></span>
<span class="line"><span style="color:#569CD6;">set-cookie:</span><span style="color:#CE9178;"> SESSDATA=***; Path=/; Domain=bilibili.com; Expires=Sat, 04 Mar 2023 07:30:09 GMT; HttpOnly; Secure</span></span>
<span class="line"><span style="color:#569CD6;">set-cookie:</span><span style="color:#CE9178;"> bili_jct=***; Path=/; Domain=bilibili.com; Expires=Sat, 04 Mar 2023 07:30:09 GMT</span></span>
<span class="line"><span style="color:#569CD6;">set-cookie:</span><span style="color:#CE9178;"> DedeUserID=***; Path=/; Domain=bilibili.com; Expires=Sat, 04 Mar 2023 07:30:09 GMT</span></span>
<span class="line"><span style="color:#569CD6;">set-cookie:</span><span style="color:#CE9178;"> DedeUserID__ckMd5=***; Path=/; Domain=bilibili.com; Expires=Sat, 04 Mar 2023 07:30:09 GMT</span></span>
<span class="line"><span style="color:#569CD6;">set-cookie:</span><span style="color:#CE9178;"> sid=***; Path=/; Domain=bilibili.com; Expires=Sat, 04 Mar 2023 07:30:09 GMT</span></span>
<span class="line"><span style="color:#569CD6;">x-bili-trace-id:</span><span style="color:#CE9178;"> 2fbd8abd97dbd4db0d23fe044a6315a5</span></span>
<span class="line"><span style="color:#569CD6;">x-cache-webcdn:</span><span style="color:#CE9178;"> BYPASS from blzone02</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details><p>二维码失效时<code>code</code>为<code>86038</code></p><details><summary>查看响应示例：</summary><div class="language-json line-numbers-mode" data-highlighter="shiki" data-ext="json" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-json"><span class="line"><span style="color:#D4D4D4;">{</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;code&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">0</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;message&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;0&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;ttl&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">1</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;data&quot;</span><span style="color:#D4D4D4;">: {</span></span>
<span class="line"><span style="color:#9CDCFE;">      &quot;url&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">      &quot;refresh_token&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">      &quot;timestamp&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">0</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">      &quot;code&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">86038</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">      &quot;message&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;二维码已失效&quot;</span></span>
<span class="line"><span style="color:#D4D4D4;">    }</span></span>
<span class="line"><span style="color:#D4D4D4;">}</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details><h2 id="web端扫码登录-旧版" tabindex="-1"><a class="header-anchor" href="#web端扫码登录-旧版"><span>web端扫码登录-旧版</span></a></h2><p>以下为旧版扫码登录 API，部分可正常访问</p><h3 id="申请二维码-web端-旧版" tabindex="-1"><a class="header-anchor" href="#申请二维码-web端-旧版"><span>申请二维码(web端-旧版)</span></a></h3><blockquote><p>https://passport.bilibili.com/qrcode/getLoginUrl</p></blockquote><p><em>请求方式：GET</em></p><p>密钥超时为180秒</p><p><strong>json回复：</strong></p><p>根对象：</p><table><thead><tr><th>字段</th><th>类型</th><th>内容</th><th>备注</th></tr></thead><tbody><tr><td>code</td><td>num</td><td>返回值</td><td>0：成功</td></tr><tr><td>status</td><td>bool</td><td>true</td><td>作用尚不明确</td></tr><tr><td>ts</td><td>num</td><td>请求时间</td><td>时间戳</td></tr><tr><td>data</td><td>obj</td><td>信息本体</td><td></td></tr></tbody></table><p><code>data</code>对象：</p><table><thead><tr><th>字段</th><th>类型</th><th>内容</th><th>备注</th></tr></thead><tbody><tr><td>url</td><td>str</td><td>二维码内容 (登录页面 url)</td><td></td></tr><tr><td>oauthKey</td><td>str</td><td>扫码登录秘钥</td><td>恒为32字符</td></tr></tbody></table><p><strong>示例：</strong></p><p><code>url</code>中的值生成二维码，等待手机客户端扫描，并将<code>oauthKey</code>保存备用</p><div class="language-shell line-numbers-mode" data-highlighter="shiki" data-ext="shell" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-shell"><span class="line"><span style="color:#DCDCAA;">curl</span><span style="color:#CE9178;"> &#39;https://passport.bilibili.com/qrcode/getLoginUrl&#39;</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div></div></div><details><summary>查看响应示例：</summary><div class="language-json line-numbers-mode" data-highlighter="shiki" data-ext="json" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-json"><span class="line"><span style="color:#D4D4D4;">{</span></span>
<span class="line"><span style="color:#9CDCFE;">	&quot;code&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">0</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">	&quot;status&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#569CD6;">true</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">	&quot;ts&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">1583314311</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">	&quot;data&quot;</span><span style="color:#D4D4D4;">: {</span></span>
<span class="line"><span style="color:#9CDCFE;">		&quot;url&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;https://passport.bilibili.com/qrcode/h5/login?oauthKey=c3bd5286a2b40a822f5f60e9bf3f602e&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">		&quot;oauthKey&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;c3bd5286a2b40a822f5f60e9bf3f602e&quot;</span></span>
<span class="line"><span style="color:#D4D4D4;">	}</span></span>
<span class="line"><span style="color:#D4D4D4;">}</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details><h3 id="扫码登录-web端-旧版" tabindex="-1"><a class="header-anchor" href="#扫码登录-web端-旧版"><span>扫码登录(web端-旧版)</span></a></h3><p><strong>接口已失效，请求结果始终为 <code>{ code: 20000, message: &#39;该版本已不支持当前功能，请升级新版本！&#39; }</code></strong></p><blockquote><p><s>https://passport.bilibili.com/qrcode/getLoginInfo</s></p></blockquote><p><em>请求方式：POST</em></p><details><summary>内容已过时：</summary><p>密钥超时为180秒</p><p>验证登录成功后会进行设置以下cookie项：</p><p><code>DedeUserID</code> <code>DedeUserID__ckMd5</code> <code>SESSDATA</code> <code>bili_jct</code></p><p><strong>正文参数（ application/x-www-form-urlencoded ）：</strong></p><table><thead><tr><th>参数名</th><th>类型</th><th>内容</th><th>必要性</th><th>备注</th></tr></thead><tbody><tr><td>oauthKey</td><td>str</td><td>扫码登录秘钥</td><td>必要</td><td></td></tr><tr><td>gourl</td><td>str</td><td>跳转url</td><td>非必要</td><td>默认为http://www.bilibili.com</td></tr></tbody></table><p><strong>json回复：</strong></p><p>根对象：</p><table><thead><tr><th>字段</th><th>类型</th><th>内容</th><th>备注</th></tr></thead><tbody><tr><td>code</td><td>num</td><td>返回值</td><td>0：成功，<br>20000：该版本已不支持当前功能，请升级新版本！</td></tr><tr><td>message</td><td>str</td><td></td><td>正确无</td></tr><tr><td>ts</td><td>num</td><td>扫码时间</td><td>错误无</td></tr><tr><td>status</td><td>bool</td><td>扫码是否成功</td><td>true：成功<br>false：未成功</td></tr><tr><td>data</td><td>正确时：obj<br>错误时：num</td><td>正确时：游戏分站url<br>错误时：错误代码</td><td>未成功时：<br>-1：密钥错误<br>-2：密钥超时<br>-4：未扫描<br>-5：未确认</td></tr></tbody></table><p>data 对象：</p><table><thead><tr><th>字段</th><th>类型</th><th>内容</th><th>备注</th></tr></thead><tbody><tr><td>url</td><td>str</td><td>游戏分站跨域登录 url</td><td></td></tr></tbody></table><p><strong>示例：</strong></p><p>使用扫描秘钥<code>c3bd5286a2b40a822f5f60e9bf3f602e</code>登录</p><div class="language-shell line-numbers-mode" data-highlighter="shiki" data-ext="shell" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-shell"><span class="line"><span style="color:#DCDCAA;">curl</span><span style="color:#CE9178;"> &quot;https://passport.bilibili.com/qrcode/getLoginInfo&quot;</span><span style="color:#D7BA7D;">\\</span></span>
<span class="line"><span style="color:#D4D4D4;">--data-urlencode </span><span style="color:#CE9178;">&#39;oauthKey=c3bd5286a2b40a822f5f60e9bf3f602e&#39;</span><span style="color:#D7BA7D;"> \\</span></span>
<span class="line"><span style="color:#D4D4D4;">-c </span><span style="color:#CE9178;">&#39;cookie.txt&#39;</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>当密钥正确时但未扫描时<code>status</code>为<code>false</code>，<code>data</code>为<code>-4</code></p><details><summary>查看响应示例：</summary><div class="language-json line-numbers-mode" data-highlighter="shiki" data-ext="json" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-json"><span class="line"><span style="color:#D4D4D4;">{</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;status&quot;</span><span style="color:#D4D4D4;">:</span><span style="color:#569CD6;">false</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;data&quot;</span><span style="color:#D4D4D4;">:</span><span style="color:#B5CEA8;">-4</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;message&quot;</span><span style="color:#D4D4D4;">:</span><span style="color:#CE9178;">&quot;Can&#39;t scan~&quot;</span></span>
<span class="line"><span style="color:#D4D4D4;">}</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details><p>扫描成功但手机端未确认时<code>status</code>为<code>false</code>，<code>data</code>为<code>-5</code></p><details><summary>查看响应示例：</summary><div class="language-json line-numbers-mode" data-highlighter="shiki" data-ext="json" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-json"><span class="line"><span style="color:#D4D4D4;">{</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;status&quot;</span><span style="color:#D4D4D4;">:</span><span style="color:#569CD6;">false</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;data&quot;</span><span style="color:#D4D4D4;">:</span><span style="color:#B5CEA8;">-5</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;message&quot;</span><span style="color:#D4D4D4;">:</span><span style="color:#CE9178;">&quot;Can&#39;t confirm~&quot;</span></span>
<span class="line"><span style="color:#D4D4D4;">}</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details><p>扫描成功手机端确认登录后，<code>status</code>为<code>true</code>，<code>data</code>为对象，并向浏览器写入cookie</p><details><summary>查看响应示例：</summary><div class="language-json line-numbers-mode" data-highlighter="shiki" data-ext="json" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-json"><span class="line"><span style="color:#D4D4D4;">{</span></span>
<span class="line"><span style="color:#9CDCFE;">	&quot;code&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">0</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">	&quot;status&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#569CD6;">true</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">	&quot;ts&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">1583315474</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">	&quot;data&quot;</span><span style="color:#D4D4D4;">: {</span></span>
<span class="line"><span style="color:#9CDCFE;">		&quot;url&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;https://passport.biligame.com/crossDomain?DedeUserID=***&amp;DedeUserID__ckMd5=***&amp;Expires=***&amp;SESSDATA=***&amp;bili_jct=***&amp;gourl=http%3A%2F%2Fwww.bilibili.com&quot;</span></span>
<span class="line"><span style="color:#D4D4D4;">	}</span></span>
<span class="line"><span style="color:#D4D4D4;">}</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details><p><strong>响应头部抓包信息：</strong></p><p>可明显看见设置了几个cookie</p><details><summary>查看响应示例：</summary><div class="language-http line-numbers-mode" data-highlighter="shiki" data-ext="http" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-http"><span class="line"><span style="color:#569CD6;">HTTP</span><span style="color:#D4D4D4;">/</span><span style="color:#B5CEA8;">1.1</span><span style="color:#B5CEA8;"> 200</span><span style="color:#CE9178;"> OK</span></span>
<span class="line"><span style="color:#569CD6;">Date:</span><span style="color:#CE9178;"> Wed, 04 Mar 2020 10:36:37 GMT</span></span>
<span class="line"><span style="color:#569CD6;">Content-Type:</span><span style="color:#CE9178;"> application/json;charset=UTF-8</span></span>
<span class="line"><span style="color:#569CD6;">Transfer-Encoding:</span><span style="color:#CE9178;"> chunked</span></span>
<span class="line"><span style="color:#569CD6;">Connection:</span><span style="color:#CE9178;"> keep-alive</span></span>
<span class="line"><span style="color:#569CD6;">Server:</span><span style="color:#CE9178;"> Apache-Coyote/1.1</span></span>
<span class="line"><span style="color:#569CD6;">Set-Cookie:</span><span style="color:#CE9178;"> sid=***; Domain=.bilibili.com; Expires=Thu, 04-Mar-2021 10:36:37 GMT; Path=/</span></span>
<span class="line"><span style="color:#569CD6;">Set-Cookie:</span><span style="color:#CE9178;"> DedeUserID=***; Domain=.bilibili.com; Expires=Mon, 31-Aug-2020 10:19:57 GMT; Path=/</span></span>
<span class="line"><span style="color:#569CD6;">Set-Cookie:</span><span style="color:#CE9178;"> DedeUserID__ckMd5=***; Domain=.bilibili.com; Expires=Mon, 31-Aug-2020 10:19:57 GMT; Path=/</span></span>
<span class="line"><span style="color:#569CD6;">Set-Cookie:</span><span style="color:#CE9178;"> SESSDATA=***; Domain=.bilibili.com; Expires=Mon, 31-Aug-2020 10:19:57 GMT; Path=/; HttpOnly</span></span>
<span class="line"><span style="color:#569CD6;">Set-Cookie:</span><span style="color:#CE9178;"> bili_jct=***; Domain=.bilibili.com; Expires=Mon, 31-Aug-2020 10:19:57 GMT; Path=/</span></span>
<span class="line"><span style="color:#569CD6;">Expires:</span><span style="color:#CE9178;"> Wed, 04 Mar 2020 10:36:36 GMT</span></span>
<span class="line"><span style="color:#569CD6;">Cache-Control:</span><span style="color:#CE9178;"> no-cache</span></span>
<span class="line"><span style="color:#569CD6;">X-Cache-Webcdn:</span><span style="color:#CE9178;"> BYPASS from ks-sxhz-dx-w-01</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details></details><h2 id="tv端扫码登录" tabindex="-1"><a class="header-anchor" href="#tv端扫码登录"><span>TV端扫码登录</span></a></h2><h3 id="申请二维码-tv端" tabindex="-1"><a class="header-anchor" href="#申请二维码-tv端"><span>申请二维码(TV端)</span></a></h3><blockquote><p>https://passport.snm0516.aisee.tv/x/passport-tv-login/qrcode/auth_code</p><p>https://passport.bilibili.com/x/passport-tv-login/qrcode/auth_code</p></blockquote><p><em>请求方式：POST</em></p><p>鉴权方式：appkey</p><p>密钥超时为180秒</p><p>本接口可申请用于TV端APP方式登录的<code>access_key</code></p><p><strong>正文参数（ application/x-www-form-urlencoded ）：</strong></p><table><thead><tr><th>参数名</th><th>类型</th><th>内容</th><th>必要性</th><th>备注</th></tr></thead><tbody><tr><td>appkey</td><td>str</td><td>APP 密钥</td><td>APP 方式必要</td><td><a href="#appkey-%E5%8F%AF%E7%94%A8%E5%88%97%E8%A1%A8">可用</a></td></tr><tr><td>local_id</td><td>num</td><td>TV 端 id</td><td>TV 端必要</td><td>可为<code>0</code></td></tr><tr><td>ts</td><td>num</td><td>当前时间戳</td><td>APP 方式必要</td><td></td></tr><tr><td>sign</td><td>str</td><td>APP 签名</td><td>APP 方式必要</td><td></td></tr><tr><td>mobi_app</td><td>str</td><td>平台标识</td><td>非必要</td><td>会被拼接到返回的 url query</td></tr></tbody></table><p><strong>json回复：</strong></p><p>根对象：</p><table><thead><tr><th>字段</th><th>类型</th><th>内容</th><th>备注</th></tr></thead><tbody><tr><td>code</td><td>num</td><td>返回值</td><td>0：成功<br>-3：API校验密匙错误<br>-400：请求错误</td></tr><tr><td>message</td><td>str</td><td>错误信息</td><td>默认为0</td></tr><tr><td>ttl</td><td>num</td><td>1</td><td></td></tr><tr><td>data</td><td>obj</td><td>信息本体</td><td></td></tr></tbody></table><p><code>data</code>对象：</p><table><thead><tr><th>字段</th><th>类型</th><th>内容</th><th>备注</th></tr></thead><tbody><tr><td>url</td><td>str</td><td>二维码内容 url</td><td></td></tr><tr><td>auth_code</td><td>str</td><td>扫码登录秘钥</td><td>恒为 32 字符</td></tr></tbody></table><p><strong>示例：</strong></p><div class="language-shell line-numbers-mode" data-highlighter="shiki" data-ext="shell" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-shell"><span class="line"><span style="color:#DCDCAA;">curl</span><span style="color:#CE9178;"> &#39;https://passport.snm0516.aisee.tv/x/passport-tv-login/qrcode/auth_code&#39;</span><span style="color:#D7BA7D;"> \\</span></span>
<span class="line"><span style="color:#D4D4D4;">--data-urlencode </span><span style="color:#CE9178;">&#39;appkey=4409e2ce8ffd12b8&#39;</span><span style="color:#D7BA7D;"> \\</span></span>
<span class="line"><span style="color:#D4D4D4;">--data-urlencode </span><span style="color:#CE9178;">&#39;local_id=0&#39;</span><span style="color:#D7BA7D;"> \\</span></span>
<span class="line"><span style="color:#D4D4D4;">--data-urlencode </span><span style="color:#CE9178;">&#39;ts=0&#39;</span><span style="color:#D7BA7D;"> \\</span></span>
<span class="line"><span style="color:#D4D4D4;">--data-urlencode </span><span style="color:#CE9178;">&#39;sign=e134154ed6add881d28fbdf68653cd9c&#39;</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><details><summary>查看响应示例：</summary><div class="language-json line-numbers-mode" data-highlighter="shiki" data-ext="json" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-json"><span class="line"><span style="color:#D4D4D4;">{</span></span>
<span class="line"><span style="color:#9CDCFE;">  &quot;code&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">0</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">  &quot;message&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;0&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">  &quot;ttl&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">1</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">  &quot;data&quot;</span><span style="color:#D4D4D4;">: {</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;url&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;https://passport.bilibili.com/x/passport-tv-login/h5/qrcode/auth?auth_code=0eeb635a64526709d70cb4c854a3b001&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;auth_code&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;0eeb635a64526709d70cb4c854a3b001&quot;</span></span>
<span class="line"><span style="color:#D4D4D4;">  }</span></span>
<span class="line"><span style="color:#D4D4D4;">}</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details><h3 id="扫码登录-tv端" tabindex="-1"><a class="header-anchor" href="#扫码登录-tv端"><span>扫码登录(TV端)</span></a></h3><blockquote><p>https://passport.snm0516.aisee.tv/x/passport-tv-login/qrcode/poll</p><p>https://passport.bilibili.com/x/passport-tv-login/qrcode/poll</p></blockquote><p><em>请求方式：POST</em></p><p>鉴权方式：appkey</p><p>密钥超时为180秒</p><p>验证登录成功后会返回可用于APP方式登录的<code>access_key</code>以及<code>refresh_token</code></p><p><strong>正文参数 (application/x-www-form-urlencoded)：</strong></p><table><thead><tr><th>参数名</th><th>类型</th><th>内容</th><th>必要性</th><th>备注</th></tr></thead><tbody><tr><td>appkey</td><td>str</td><td>APP密钥</td><td>APP方式必要</td><td><a href="#appkey-%E5%8F%AF%E7%94%A8%E5%88%97%E8%A1%A8">可用</a></td></tr><tr><td>auth_code</td><td>str</td><td>扫码秘钥</td><td>必要</td><td></td></tr><tr><td>local_id</td><td>num</td><td>TV端id</td><td>TV端必要</td><td>可为0</td></tr><tr><td>ts</td><td>num</td><td>当前时间戳</td><td>APP方式必要</td><td></td></tr><tr><td>sign</td><td>str</td><td>APP签名</td><td>APP方式必要</td><td></td></tr></tbody></table><p><strong>json回复：</strong></p><p>根对象：</p><table><thead><tr><th>字段</th><th>类型</th><th>内容</th><th>备注</th></tr></thead><tbody><tr><td>code</td><td>num</td><td>返回值</td><td>0：成功<br>-3：API校验密匙错误<br>-400：请求错误<br>-404：啥都木有<br>86038：二维码已失效<br>86039：二维码尚未确认<br>86090：二维码已扫码未确认</td></tr><tr><td>message</td><td>str</td><td>错误信息</td><td>默认为0</td></tr><tr><td>ttl</td><td>num</td><td>1</td><td></td></tr><tr><td>data</td><td>有效时：obj<br>无效时：null</td><td>信息本体</td><td></td></tr></tbody></table><p><code>data</code>对象：</p><table><thead><tr><th>字段</th><th>类型</th><th>内容</th><th>备注</th></tr></thead><tbody><tr><td>mid</td><td>num</td><td>登录用户mid</td><td></td></tr><tr><td>access_token</td><td>str</td><td>APP登录Token</td><td></td></tr><tr><td>refresh_token</td><td>str</td><td>APP刷新Token</td><td></td></tr><tr><td>expires_in</td><td>num</td><td>有效时间</td><td>默认：15552000秒，等于180天</td></tr></tbody></table><p><strong>示例：</strong></p><p>使用扫描秘钥<code>6214464b3025541abf6f654cf7569a01</code>进行验证登录</p><div class="language-shell line-numbers-mode" data-highlighter="shiki" data-ext="shell" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-shell"><span class="line"><span style="color:#DCDCAA;">curl</span><span style="color:#CE9178;"> &#39;https://passport.snm0516.aisee.tv/x/passport-tv-login/qrcode/poll&#39;</span><span style="color:#D7BA7D;"> \\</span></span>
<span class="line"><span style="color:#D4D4D4;">--data-urlencode </span><span style="color:#CE9178;">&#39;appkey=4409e2ce8ffd12b8&#39;</span><span style="color:#D7BA7D;"> \\</span></span>
<span class="line"><span style="color:#D4D4D4;">--data-urlencode </span><span style="color:#CE9178;">&#39;auth_code=6214464b3025541abf6f654cf7569a01&#39;</span><span style="color:#D7BA7D;"> \\</span></span>
<span class="line"><span style="color:#D4D4D4;">--data-urlencode </span><span style="color:#CE9178;">&#39;local_id=0&#39;</span><span style="color:#D7BA7D;"> \\</span></span>
<span class="line"><span style="color:#D4D4D4;">--data-urlencode </span><span style="color:#CE9178;">&#39;ts=0&#39;</span><span style="color:#D7BA7D;"> \\</span></span>
<span class="line"><span style="color:#D4D4D4;">--data-urlencode </span><span style="color:#CE9178;">&#39;sign=87de3d0fee7c3f4facd244537238914e&#39;</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><details><summary>查看响应示例：</summary><div class="language-json line-numbers-mode" data-highlighter="shiki" data-ext="json" style="background-color:#1E1E1E;color:#D4D4D4;"><pre class="shiki dark-plus vp-code"><code class="language-json"><span class="line"><span style="color:#D4D4D4;">{</span></span>
<span class="line"><span style="color:#9CDCFE;">  &quot;code&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">0</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">  &quot;message&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;0&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">  &quot;ttl&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">1</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">  &quot;data&quot;</span><span style="color:#D4D4D4;">: {</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;is_new&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#569CD6;">false</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;mid&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">10086</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;access_token&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;********************************&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;refresh_token&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;********************************&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;expires_in&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">15552000</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;token_info&quot;</span><span style="color:#D4D4D4;">: {</span></span>
<span class="line"><span style="color:#9CDCFE;">      &quot;mid&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">10086</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">      &quot;access_token&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;********************************&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">      &quot;refresh_token&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;********************************&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">      &quot;expires_in&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">15552000</span></span>
<span class="line"><span style="color:#D4D4D4;">    },</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;cookie_info&quot;</span><span style="color:#D4D4D4;">: {</span></span>
<span class="line"><span style="color:#9CDCFE;">      &quot;cookies&quot;</span><span style="color:#D4D4D4;">: [</span></span>
<span class="line"><span style="color:#D4D4D4;">        {</span></span>
<span class="line"><span style="color:#9CDCFE;">          &quot;name&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;SESSDATA&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">          &quot;value&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;********************************&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">          &quot;http_only&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">1</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">          &quot;expires&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">1679988973</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">          &quot;secure&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">0</span></span>
<span class="line"><span style="color:#D4D4D4;">        },</span></span>
<span class="line"><span style="color:#D4D4D4;">        {</span></span>
<span class="line"><span style="color:#9CDCFE;">          &quot;name&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;bili_jct&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">          &quot;value&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;********************************&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">          &quot;http_only&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">0</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">          &quot;expires&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">1679988973</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">          &quot;secure&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">0</span></span>
<span class="line"><span style="color:#D4D4D4;">        },</span></span>
<span class="line"><span style="color:#D4D4D4;">        {</span></span>
<span class="line"><span style="color:#9CDCFE;">          &quot;name&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;DedeUserID&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">          &quot;value&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;*******&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">          &quot;http_only&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">0</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">          &quot;expires&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">1679988973</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">          &quot;secure&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">0</span></span>
<span class="line"><span style="color:#D4D4D4;">        },</span></span>
<span class="line"><span style="color:#D4D4D4;">        {</span></span>
<span class="line"><span style="color:#9CDCFE;">          &quot;name&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;DedeUserID__ckMd5&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">          &quot;value&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;****************&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">          &quot;http_only&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">0</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">          &quot;expires&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">1679988973</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">          &quot;secure&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">0</span></span>
<span class="line"><span style="color:#D4D4D4;">        },</span></span>
<span class="line"><span style="color:#D4D4D4;">        {</span></span>
<span class="line"><span style="color:#9CDCFE;">          &quot;name&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;sid&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">          &quot;value&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#CE9178;">&quot;********&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">          &quot;http_only&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">0</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">          &quot;expires&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">1679988973</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#9CDCFE;">          &quot;secure&quot;</span><span style="color:#D4D4D4;">: </span><span style="color:#B5CEA8;">0</span></span>
<span class="line"><span style="color:#D4D4D4;">        }</span></span>
<span class="line"><span style="color:#D4D4D4;">      ],</span></span>
<span class="line"><span style="color:#9CDCFE;">      &quot;domains&quot;</span><span style="color:#D4D4D4;">: [</span></span>
<span class="line"><span style="color:#CE9178;">        &quot;.bilibili.com&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#CE9178;">        &quot;.biligame.com&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#CE9178;">        &quot;.bigfun.cn&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#CE9178;">        &quot;.bigfunapp.cn&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#CE9178;">        &quot;.dreamcast.hk&quot;</span></span>
<span class="line"><span style="color:#D4D4D4;">      ]</span></span>
<span class="line"><span style="color:#D4D4D4;">    },</span></span>
<span class="line"><span style="color:#9CDCFE;">    &quot;sso&quot;</span><span style="color:#D4D4D4;">: [</span></span>
<span class="line"><span style="color:#CE9178;">      &quot;https://passport.bilibili.com/api/v2/sso&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#CE9178;">      &quot;https://passport.biligame.com/api/v2/sso&quot;</span><span style="color:#D4D4D4;">,</span></span>
<span class="line"><span style="color:#CE9178;">      &quot;https://passport.bigfunapp.cn/api/v2/sso&quot;</span></span>
<span class="line"><span style="color:#D4D4D4;">    ]</span></span>
<span class="line"><span style="color:#D4D4D4;">  }</span></span>
<span class="line"><span style="color:#D4D4D4;">}</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></details><h3 id="appkey-可用列表" tabindex="-1"><a class="header-anchor" href="#appkey-可用列表"><span>appkey 可用列表</span></a></h3>`,100)),l("p",null,[l("strong",null,[s[1]||(s[1]=n("仅覆盖 ")),p(e,{to:"/docs/misc/sign/APPKey.html"},{default:c(()=>s[0]||(s[0]=[n("docs/misc/sign/APPKey")])),_:1,__:[0]}),s[2]||(s[2]=n(" 中包含的 appkey"))])]),s[4]||(s[4]=a('<table><thead><tr><th style="text-align:center;">APPKEY</th><th style="text-align:center;">APPSEC</th><th style="text-align:center;">platform</th><th style="text-align:center;">APP类型</th><th style="text-align:center;">neuronAppId</th><th style="text-align:center;">mobi_app<sup>2</sup></th><th style="text-align:center;">备注</th></tr></thead><tbody><tr><td style="text-align:center;">783bbb7264451d82</td><td style="text-align:center;">2653583c8873dea268ab9386918b1d65</td><td style="text-align:center;"><code>android</code></td><td style="text-align:center;">粉版</td><td style="text-align:center;"><code>1</code></td><td style="text-align:center;"><code>android</code></td><td style="text-align:center;">仅获取用户信息时使用(7.X及更新版本)</td></tr><tr><td style="text-align:center;">8d23902c1688a798</td><td style="text-align:center;">710f0212e62bd499b8d3ac6e1db9302a</td><td style="text-align:center;"><code>android</code></td><td style="text-align:center;">AndroidBiliThings</td><td style="text-align:center;">?</td><td style="text-align:center;">?</td><td style="text-align:center;"></td></tr><tr><td style="text-align:center;">bca7e84c2d947ac6</td><td style="text-align:center;">60698ba2f68e01ce44738920a0ffe768</td><td style="text-align:center;">?</td><td style="text-align:center;">login</td><td style="text-align:center;">-</td><td style="text-align:center;">?</td><td style="text-align:center;"></td></tr><tr><td style="text-align:center;">27eb53fc9058f8c3</td><td style="text-align:center;">c2ed53a74eeefe3cf99fbd01d8c9c375</td><td style="text-align:center;"><code>web</code>/<code>ios</code>?</td><td style="text-align:center;">-</td><td style="text-align:center;">-</td><td style="text-align:center;">-</td><td style="text-align:center;">第三方授权使用</td></tr><tr><td style="text-align:center;">4409e2ce8ffd12b8</td><td style="text-align:center;">59b43e04ad6965f34319062b478f83dd</td><td style="text-align:center;"><code>android</code></td><td style="text-align:center;">云视听小电视(TV版)</td><td style="text-align:center;"><code>9</code>?</td><td style="text-align:center;"><code>android_tv_yst</code>?</td><td style="text-align:center;"></td></tr><tr><td style="text-align:center;">dfca71928277209b</td><td style="text-align:center;">b5475a8825547a4fc26c7d518eaaa02e</td><td style="text-align:center;"><code>android</code></td><td style="text-align:center;">HD 版</td><td style="text-align:center;"><code>5</code></td><td style="text-align:center;"><code>android_hd</code></td><td style="text-align:center;"></td></tr></tbody></table><p><strong>注意：</strong></p><p>通过某一组 APPKEY/APPSEC 获取到的 access_token，当接口需要 <code>sign</code> 签名时也只能使用该组 APPKEY/APPSEC，否则出现 <code>{ code: -663, message: &#39;鉴权失败，请联系账号组&#39;, ttl: 1 }</code> 错误。</p><p><strong>例外：</strong></p><p><code>783bbb7264451d82</code>/<code>2653583c8873dea268ab9386918b1d65</code> 获取到的 access_token 可配合 <code>1d8b6e7d45233436</code>/<code>560c52ccd288fed045859ed18bffd973</code> 使用。</p>',5))])}const v=t(D,[["render",u]]),m=JSON.parse('{"path":"/docs/login/login_action/QR.html","title":"二维码登录","lang":"zh-CN","frontmatter":{},"git":{"updatedTime":1706520417000,"contributors":[{"name":"SocialSisterYi","username":"SocialSisterYi","email":"1440239038@qq.com","commits":2,"url":"https://github.com/SocialSisterYi"},{"name":"Ryuujo Zhang","username":"","email":"me@ryuujo.com","commits":1},{"name":"LaMerChiang","username":"LaMerChiang","email":"catlair@qq.com","commits":2,"url":"https://github.com/LaMerChiang"},{"name":"SessionHu","username":"SessionHu","email":"102411014+SessionHu@users.noreply.github.com","commits":1,"url":"https://github.com/SessionHu"}],"changelog":[{"hash":"12e014afcb376e0314e0fdef2dab5c4f7b9fdde7","time":1706520417000,"email":"102411014+SessionHu@users.noreply.github.com","author":"Session小胡","message":"fix: 错误的显示和链接和数据类型 (#954)"},{"hash":"aacf89d0475cc04af002aae1a3a805d920441048","time":1702563778000,"email":"catlair@qq.com","author":"LaMerChiang","message":"Update QR.md 申请二维码(TV端)错误的备注 (#901)"},{"hash":"c0d0623ef5ec288f326cd200a79804bee778c842","time":1702478637000,"email":"catlair@qq.com","author":"LaMerChiang","message":"Update QR.md (#900)"},{"hash":"81eb5a414fbab840e257602f252bca9867334e90","time":1685882061000,"email":"me@ryuujo.com","author":"Ryuujo Zhang","message":"Update QR.md (#697)"},{"hash":"f6760f4be38d5b592d396b211e48c666286524de","time":1677124138000,"email":"1440239038@qq.com","author":"SocialSisterYi","message":"🔨remove header index"},{"hash":"7d89ece2ac46425810647c4ac92acf5f3721cb68","time":1676998806000,"email":"1440239038@qq.com","author":"SocialSisterYi","message":"🚀调整项目结构"}]},"filePathRelative":"docs/login/login_action/QR.md"}');export{v as comp,m as data};
