Last active
October 2, 2026 14:02
-
-
Save uhwot/8250904f3e4bfbad684c5ec26943e082 to your computer and use it in GitHub Desktop.
allows logging in via auth tokens on play.qobuz.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name qobuz auth token login | |
| // @namespace io.github.uhwot.qbztoken | |
| // @match https://play.qobuz.com/* | |
| // @grant none | |
| // @version 1.0 | |
| // @author uh wot | |
| // @description allows logging in via auth tokens on qobuz | |
| // @homepageURL https://gist.github.com/uhwot/8250904f3e4bfbad684c5ec26943e082 | |
| // @downloadURL https://gist.github.com/uhwot/8250904f3e4bfbad684c5ec26943e082/raw/qbztoken.user.js | |
| // @icon https://play.qobuz.com/resources/favicon/favicon-96x96.png | |
| // @run-at document-start | |
| // ==/UserScript== | |
| function waitForElm(selector) { | |
| return new Promise(resolve => { | |
| if (document.querySelector(selector)) { | |
| return resolve(document.querySelector(selector)); | |
| } | |
| const observer = new MutationObserver(mutations => { | |
| if (document.querySelector(selector)) { | |
| resolve(document.querySelector(selector)); | |
| observer.disconnect(); | |
| } | |
| }); | |
| observer.observe(document.body, { | |
| childList: true, | |
| subtree: true | |
| }); | |
| }); | |
| } | |
| function ass() { | |
| if (window.location.pathname === "/login") { | |
| waitForElm("div.LoginPage__content").then((_) => { | |
| const element = document.querySelector("div.LoginPage__content") | |
| const div = document.createElement("div") | |
| div.setAttribute("style", "width: 100%") | |
| const p = document.createElement("p") | |
| p.innerText = "Token:" | |
| p.setAttribute("style", "color: #FFFFFF") | |
| div.appendChild(p) | |
| const input = document.createElement("input") | |
| input.setAttribute("class", "SearchBar__input") | |
| input.setAttribute("type", "password") | |
| input.setAttribute("style", "padding: 0px 10px 0px 10px; width: 100%") | |
| input.addEventListener("keypress", function(event) { | |
| if (event.key === "Enter") { | |
| event.preventDefault() | |
| localStorage.setItem("shitass", input.value) | |
| window.location = "https://play.qobuz.com/featured?code_autorisation=!shitass!" | |
| } | |
| }) | |
| div.appendChild(input) | |
| element.appendChild(div) | |
| }) | |
| } | |
| } | |
| const token = localStorage.getItem("shitass") | |
| if (window.location == "https://play.qobuz.com/featured?code_autorisation=!shitass!" && token !== null) { | |
| localStorage.removeItem("shitass") | |
| window.fetch = (function (fetch) { | |
| return async function (url, init) { | |
| if (url.startsWith("https://www.qobuz.com/api.json/0.2/oauth/callback?code=!shitass!")) { | |
| window.fetch = fetch | |
| return new Response(JSON.stringify({ | |
| token: token, | |
| user_id: "1" | |
| })) | |
| } | |
| return await fetch(url, init) | |
| } | |
| })(window.fetch); | |
| } | |
| window.addEventListener('load', function() { | |
| ass() | |
| const replaceState = window.history.replaceState | |
| Object.defineProperty(window.history, 'replaceState', { | |
| get(_) {return function() { | |
| replaceState.apply(window.history, arguments) | |
| ass() | |
| }}, | |
| set(_) {}, | |
| }); | |
| const pushState = window.history.pushState | |
| Object.defineProperty(window.history, 'pushState', { | |
| get(_) {return function() { | |
| pushState.apply(window.history, arguments) | |
| ass() | |
| }}, | |
| set(_) {}, | |
| }); | |
| }, false) |
@11ph22il it works, thanks! (thorium browser v150 beta)
Does not work for me. I tried Firefox and Opera, with and without the CORS addons
I have forked the code and provided an update here which works for me and one other (according to the comments). Can anyone else test it and let me know/provide feedback?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@11ph22il im using microsoft edge and your modded version works fine for me, thanks!