-
Notifications
You must be signed in to change notification settings - Fork 215
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
400 Bad Request error when using oauth, but browser authentication works #676
Comments
I too have started getting this, though, I can't get the browser auth to work either. |
Could you try messing with the headers to see if removing some fixes it? Hard to tell what the issue is without further indication |
Hmm, I ran test requests using this code: from ytmusicapi import YTMusic
conn = YTMusic("oauth.json")
conn.rate_song("A4zBSnMhvI0", "LIKE") While removing one of these headers each time:
All of them except Here's the full error from the API, in case it helps: {
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"errors": [
{
"message": "Request contains an invalid argument.",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
} Also tried removing The only one that had a different result was removing the |
Does anyone know where the oauth.json file is stored? I can't findi it to try and delete it |
same issue, commenting for visibility! guessing its a server side change that break the api |
Someone in the linked spotify_to_ytmusic issue mentioned it works for them as Manager of their family plan, but not for their wife and kids (non-managers). I am in the same situation (non-manager), is everyone else experiencing the issue also a non-manager on a family plan? |
This seems related to what I've noticed: it's working fine for me when using oauth creds for one account that is a primary account of mine, but it does not work on another which is a "brand account" under a second account. I get Edit: on further testing, it seems like my 2nd account (which is under a family plan), whether I use its primary or brand account, fail with this error, so my experience supports @AntitrustEnthusiast hypothesis. |
My account is the manager of my family plan and I get the |
i am seeing this issue as a manager of a family plan. |
Same here when calling yt.get_history(). I also tried updating to no avail. Currently on ver. 1.8.2. |
I doubt this is related to family plans, likely just a coincidence. I would suspect that something in here broke/needs to be updated due the server-side update: https://github.com/sigma67/ytmusicapi/blob/main/ytmusicapi/helpers.py I will try comparing our requests with the current requests on the web when I find time. Unfortunately I work a full time job so it might be a few days. I certainly recognize the importance of the issue given the number of reports. In the meantime, anyone else with the time can perform the same analysis! |
I have an individual plan and am also seeing this error. Maybe the issue is due to having multiple accounts on the plan? In my instance I use a branded account instead of my primary gmail.com account. I saw the error using my branded account, however after regenerating my oauth.json using my gmail.com account everything worked as expected. |
1. Only allow user to login with `ytmusicapi oauth` command 2. When login failed, it does not work anymore due to sigma67/ytmusicapi#676, this PR fix this issue. User can still use remain functions (like search, play_a_song) even login failed.
I'm also getting this HTTP 400 error for the last few days. Glad to see I'm not alone. I tried to generate oauth.json from 2 separate accounts and both of them fail. |
it was working for me till yesterday , today even im facing this issue , sigma67 is there any fix for this? |
We're all well aware that the issue is happening, now it's time for the open-source community to do its thing and come together and fix it. If you scroll up and read @sigma67's message, you'll see they are busy and some suggestions about where to look in the meantime. It's probably some header or something that changed on one of the requests in the oauth flow. I tried looking at the API docs for OAuth 2.0 for TV and Limited-Input Device Applications but nothing stuck out as being different. Also tried going through the oauth flow in the browser and looking at the requests/responses to see if there's anything that looks like one of the requests in the helpers.py file, but I might just be looking in the wrong place. The properties in |
Seeing same issue. Tried multiple accounts and it all fails locally and on a server. However, it does work locally without an oauth.json file. |
People in different projects are saying that Google is removing OAuth support for YTMusic, and they are switching back to using cookies 😢 The reason it happens for some accounts and not others of course is because of A/B testing (edit: well, global rollout, technically) KoljaWindeler/ytube_music_player#367 (comment) I haven't seen anything conclusive stating this to be true, but it seems like developers of different projects are seeing the writing on the wall, which points toward bye-bye for OAuth. Let's hope that's not the case...I'm not sure how to determine if it is or not. |
I agree, either A/B Testing or the nature of the global rollout. removing OAuth just seems like a direct stab at disabling these sorts of integrations. |
As expected this is a widespread issue affecting all third-party oauth clients: yt-dlp/yt-dlp#11462 Is anyone facing issues with browser-based auth also? Seems to be working ok for me |
@sigma67 confirming that browser-based auth also works for me |
For me, browser-based authentication doesn't work either. Using the get_history() (browseId: "FEmusic_history") on luisignaciocc/ytmusic-scrobbler-web#11 |
same here, works with browser authentications, the instructions are here: https://ytmusicapi.readthedocs.io/en/stable/setup/browser.html Is this authentication method going to have to be renewed regularly? |
Common advice to make long-lasting cookies is to create them using the browser's in-private session. This avoids accidentally messing with the session during your regular browsing activity The cookies last quite long in my experience |
that's good to know, thanks |
I couldn't manage to get cookies in the brave browser. I keep getting a 401 error. |
"te": "trailers\u001a" I solved the issue by removing this code from the browser.json file. However, I've been struggling with it for hours. It was so silly.
|
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Describe the bug
the
ytmusic.search()
command is throwing aHTTP 400: Bad Request
error with the messageRequest contains an invalid argument
, but only when using oauth. Browser authentication works fine.Using
ytmusicapi
version 1.8.2To Reproduce
Steps to reproduce the behavior:
ytmusicapi oauth
as documented in setupResult:
Additional context
I've been using it for quite a while without issue, but today it stopped working, seemingly at random. Switching to browser auth has temporarily fixed it for my workflow.
Deleting
oauth.json
and redoing the authentication flow didn't work either.The text was updated successfully, but these errors were encountered: