mirror of
https://github.com/sigma67/ytmusicapi.git
synced 2026-04-25 07:16:00 +03:00
[GH-ISSUE #781] Missing Authorization header in browser.json causes wrong AuthType detection (OAUTH_CUSTOM_CLIENT instead of BROWSER) #497
Labels
No labels
a/b
bug
documentation
enhancement
good first issue
help wanted
invalid
pull-request
question
wontfix
yt-error
yt-update
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/ytmusicapi#497
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Serelue on GitHub (Jun 29, 2025).
Original GitHub issue: https://github.com/sigma67/ytmusicapi/issues/781
Describe the bug
Hello, I manually created browser.json following the guide (https://ytmusicapi.readthedocs.io/en/stable/setup/browser.html#manual-file-creation)
However, ytmusicapi recognizes this file as AuthType.OAUTH_CUSTOM_CLIENT instead of AuthType.BROWSER, which causes an error.
I've written the solution below, but I'm not sure if this is a documentation issue or a code issue, so I'm posting this as a bug.
ytmusicapi version
1.10.3
To Reproduce
Additional context
browser.json file I used in my first attempt was:
I was looking for where the error occurs and I found the determine_auth_type func.
I suspected that the issue was caused by browser.json(self._auth_headers, auth_headers) failing to find the Authorization header
because this header was displayed in the browser request.
I changed browser.json like this, and it works,
https://ytmusicapi.readthedocs.io/en/stable/setup/browser.html#manual-file-creation
There was nothing about Authorization header in the documentation. (or maybe it's my mistake)
@sigma67 commented on GitHub (Aug 30, 2025):
How did you create browser.json ? I don't think the example in the docs is up to date and complete, therefore I recommend to use the CLI.
@Serelue commented on GitHub (Aug 31, 2025):
I don't remember exactly, but for some reason there was a problem with the CLI, so I created it manually.
@CodinMoldovanu commented on GitHub (Sep 8, 2025):
I've run into this as well, even when using the
ytmusicapi browseroption, it doesn't ouput an Authorization field.@sigma67 commented on GitHub (Sep 9, 2025):
Having a closer look at this it seems the format has changed: https://stackoverflow.com/questions/79378674/figuring-out-google-hashing-algorithm-for-sapisidhash-used-on-youtube-subscribe
@joshhubert-dsp commented on GitHub (Sep 10, 2025):
Yeah it looks like
auth/browser.pydoesn't correctly handle the current format for copied headers from Chrome. To be clear, the only thing missing from the minimal manual example in the docs is the "Authorization" field, so probably worth just telling Chrome users to use that.@sigma67 commented on GitHub (Sep 10, 2025):
I would be in favor of fixing the issue additionally. What is going wrong for Chrome?
@joshhubert-dsp commented on GitHub (Sep 10, 2025):
When directly copying the header from dev tools starting from "accept", there are no key/value delimiters, everything's just on its own line like:
and that's not being handled properly. The function does
header = content.split(": ")for each line, and for me at least ": " doesn't appear in the text.So I end up with:
@srajangarg commented on GitHub (Sep 19, 2025):
yeah, somehow chrome changed this recently. no longer has the
:delimiters. for now, i just manually added them myself, but it sucks to do that@joshhubert-dsp commented on GitHub (Sep 20, 2025):
Ohhh, I totally missed the "Raw" checkbox at the top of the headers section in Chrome dev tools. That adds back the delimiters and solves the problem.
@sigma67 commented on GitHub (Oct 21, 2025):
The checkbox is missing for HTTP2 requests so that's not a solution. Unfortunately there is no way around this (uncalled for) change by Chrome. So I'm tempted to just remove the Chrome part from the documentation and require to use Firefox.
@blahster commented on GitHub (Nov 27, 2025):
Chrome instructions are now updated.
Essentially, you can use “Copy as fetch (Node.js)” instead to copy headers and clean it up a bit to include only the necessary fields.
@sigma67 commented on GitHub (Nov 27, 2025):
https://github.com/sigma67/ytmusicapi/pull/833
thanks @blahster