Skip to content

Add support for new Qobuz login flow#955

Open
mikelandzelo173 wants to merge 1 commit intonathom:devfrom
mikelandzelo173:feat/qobuz-login-fix
Open

Add support for new Qobuz login flow#955
mikelandzelo173 wants to merge 1 commit intonathom:devfrom
mikelandzelo173:feat/qobuz-login-fix

Conversation

@mikelandzelo173
Copy link
Copy Markdown

Summary

This MR fixes (#954) broken Qobuz login by replacing the legacy email/password flow with a token-first workflow that supports automatic refresh when tokens expire.

What Changed

  • Switched Qobuz auth UX to token mode (use_auth_token = true) using:
    • email_or_userid = Qobuz user.id
    • password_or_token = Qobuz user_auth_token
  • Added managed-browser token capture in streamrip/rip/qobuz_token_capture.py:
    • Opens Playwright Chromium
    • Navigates to https://play.qobuz.com/login
    • Listens for https://www.qobuz.com/api.json/0.2/user/login
    • Extracts user.id and user_auth_token
    • Checks extra=partner when request payload is available
  • Integrated capture into QobuzPrompter:
    • Auto-capture first
    • Manual prompt fallback on timeout/error
    • Persist credentials to config
  • Added expired-token recovery in Main.get_logged_in_client:
    • On Qobuz AuthenticationError, rerun prompt/capture path instead of hard-failing
  • Improved Qobuz auth error handling/logging:
    • Redacted sensitive auth values in logs
    • Clearer token-expiry/token-invalid messaging
  • Updated docs/config guidance:
    • streamrip/config.toml comments now describe token auth
    • README.md documents auto-capture, Playwright setup, and manual fallback

Dependency Changes

  • Added playwright to pyproject.toml
  • Updated poetry.lock with Playwright + transitive deps (greenlet, pyee) and lock metadata/group normalization from Poetry re-resolution

Tests

  • Added/updated tests/test_qobuz_auth_flow.py coverage for:
    • token-mode login params (user_id, user_auth_token)
    • redaction and token-specific auth error messaging
    • Qobuz auth retry path in Main
    • prompter auto-capture success
    • prompter manual fallback on capture failure
    • retry after expired token using re-capture path

@mikelandzelo173
Copy link
Copy Markdown
Author

I just tested my fix on Windows 11 and freshly installed all the necessary tools: git bash, Python, pip, playwright, and Chromium. I then checked out my branch and ran the script, and as expected, it guided me through the login process. Afterwards, my user ID and token were written to the config.ini file and reused on the next run. I can therefore confirm that the fix works on both macOS and Windows 11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants