QR Code Login
The recommended way to authenticate is through QR code scanning, which is secure and straightforward.Generate QR Code
The app will fetch a login QR code from Bilibili’s authentication service (
passport.bilibili.com/x/passport-login/web/qrcode/generate).The QR code is valid for a limited time. If it expires, you’ll need to close and reopen the login modal.
Scan with Bilibili App
Open the official Bilibili mobile app and use the built-in QR scanner to scan the code displayed in BBPlayer.
- Status will update to “等待扫码” (Waiting for scan)
- After scanning, status changes to “等待确认” (Waiting for confirmation)
How It Works
The QR code login process involves:- Generation: Request a unique
qrcode_keyfrom Bilibili - Polling: Check login status every 2 seconds at
/x/passport-login/web/qrcode/poll - Status Tracking: Monitor for scan, confirmation, expiration, or success
- Cookie Extraction: Parse
Set-Cookieheaders and store session tokens
Cookie Import
For advanced users, BBPlayer supports direct cookie import from your browser or other sources.Extract Cookies
Use your browser’s developer tools to extract cookies from
bilibili.com:- Open DevTools (F12)
- Navigate to Application/Storage > Cookies
- Copy the cookie string
Import to BBPlayer
Navigate to Settings > General > Account and choose Import Cookie. Paste the cookie string.Required cookie fields:
SESSDATA: Session authentication tokenbili_jct: CSRF token for API requestsDedeUserID: User ID
Cookie Management
BBPlayer stores cookies in two locations:- App State: In-memory store for immediate access
- MMKV Storage: Persistent storage across app restarts
- Orpheus Engine: Native playback module for authenticated streaming
Authentication States
BBPlayer manages several authentication states:Logged Out
Logged Out
No cookies stored. Limited to public content only. Cannot access:
- User favorites
- Private playlists
- High-quality streams
- Personal collections
Logged In
Logged In
Valid session cookies stored. Full access to:
- All favorite lists
- Collections and series
- Authenticated API endpoints
- Higher bitrate audio streams
Session Expired
Session Expired
Cookies present but invalid. Features may fail with CSRF token errors. Re-login required.
Troubleshooting
QR Code Won’t Generate
- Check internet connectivity
- Verify Bilibili services are accessible
- Try again after a few seconds
Login Success But Features Don’t Work
- Ensure cookies include
bili_jcttoken - Check if CSRF token is valid
- Try logging out and back in
”Invalid Cookie” Error
- Verify cookie format is correct (semicolon-separated key=value pairs)
- Ensure no undefined values in cookie string
- Check for special characters or encoding issues
Security Considerations
- Cookies are stored encrypted in MMKV storage
- Session tokens are never logged or transmitted outside Bilibili APIs
- Re-authentication required after major app updates
- Cookies automatically invalidate after Bilibili’s session timeout