Bilibili App Auth

哔哩哔哩 App 端鉴权

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.org/scripts/566236/1754598/Bilibili%20App%20Auth.js

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

Author
GabrielxD
Version
1.0.0
Created
2026-02-14
Updated
2026-02-14
Size
17.8 KB
License
MIT

Bilibili App Auth

哔哩哔哩 App 端鉴权库

功能

  • 模拟 App 端请求签名(appkey / appsec + MD5 签名)
  • 内置多种 APP 预设:androidandroid_thingsthird_partytv(云视听小电视)、hd
  • 基于 EventTarget 的事件驱动扫码登录流程
  • 跨域请求封装(通过注入的 GM_xmlhttpRequest

快速上手

// ==UserScript==
// @require  https://update.greasyfork.org/scripts/566236/1754474/Bilibili%20App%20Auth.js
// @grant    GM_xmlhttpRequest
// @connect  passport.bilibili.com
// ==/UserScript==

const BilibiliAppAuth = createBilibiliAppAuth({ GM_xmlhttpRequest });
const bilibiliApp = new BilibiliAppAuth("tv"); // 使用 TV 端预设

事件

事件 触发时机 event.detail
start 获取到二维码后 -
scan 轮询中(等待扫码/已扫码) 轮询响应
completed 登录成功 登录响应数据
error 登录失败/二维码过期 错误响应
end 登录流程结束(成功或失败) 最终响应

Inspired from