Skip to content
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

Google OAuth not working #62

Closed
Rexadev opened this issue Jun 6, 2023 · 10 comments
Closed

Google OAuth not working #62

Rexadev opened this issue Jun 6, 2023 · 10 comments

Comments

@Rexadev
Copy link

Rexadev commented Jun 6, 2023

No description provided.

@sigma67
Copy link
Owner

sigma67 commented Jun 6, 2023

Well, did you try again?

@z3t4m4n
Copy link

z3t4m4n commented Jul 31, 2023

Hi,
same issue.
I placed a try/except on /home/$HOME/.local/lib/python3.11/site-packages/ytmusicapi/auth/oauth.py
( ytmusicapi 1.1.1):

    def _parse_token(response) -> Dict:                                                                                                                 
        try:                                                                                                                                            
            token = response.json()                                                                                                                     
            token["expires_at"] = int(time.time()) + int(token["expires_in"])                                                                           
        except Exception as error:                                                                                                                      
            print("An error occurred:", type(error).__name__) # An error occurred: NameError                                                            
            print(response.json())                                                                                                                      
        return token 
$ spotify_to_ytmusic setup                                                                                                            
Choose which API to set up                                                                                                                              
(1) Spotify                                                                                                                                             
(2) YouTube                                                                                                                                             
(3) both                                                                                                                                                
2                                                                                                                                                       
Go to https://www.google.com/device?user_code=XXXX-XXXX, finish the login flow and press Enter when done, Ctrl-C to abort
<Response [400]>                                                                                                                                        
An error occurred: KeyError                                                                                                                             
{'error': 'invalid_request', 'error_description': 'Credentials in post body and basic Authorization header do not match'}                               
<Response [400]>  

My google account has more than 1 youtube account linked, maybe it is related to that.

@LouisHrg
Copy link

LouisHrg commented Aug 8, 2023

Hi, same issue with all my accounts, nothing is working atm

@sigma67
Copy link
Owner

sigma67 commented Aug 29, 2023

@LouisHrg do you also have more than 1 YouTube account linked to your Google account?

@z3t4m4n
Copy link

z3t4m4n commented Aug 29, 2023

In my case, at one time you could have a YouTube account; before it was purchased by google.
Later when they purchased and merged YouTube into the google ecosystem, you got to keep the old YouTube account if you wanted, and many did as its not wise to be commenting in YouTube with your real name, and keeping your old channel/uploads,
So some people have more than one distinct YouTube accounts nested in a single google account.

@knedl1k
Copy link

knedl1k commented Oct 30, 2023

Yeah same error here. Even if I do not use the OAuth method for private playlists I cannot log into the YT.
image

@sigma67
Copy link
Owner

sigma67 commented Oct 31, 2023

Hi guys, I'm sorry that this is not working for you. This issue is account bound, so I'm unfortunately unable to help in this case.

Feel free to debug this further, the issue is probably related to the oauth functionality in ytmusicapi: https://github.com/sigma67/ytmusicapi/blob/master/ytmusicapi/auth/oauth.py

Check also here for more on how it works behind the scenes: sigma67/ytmusicapi#10 (comment)

Perhaps you can find the issue by debugging with your account on the YouTube TV interface

@Rexadev
Copy link
Author

Rexadev commented Oct 31, 2023

@LouisHrg @z3t4m4n @knedl1k Try https://github.com/yogeshwaran01/spotify-playlist-to-youtube-playlist

@sigma67
Copy link
Owner

sigma67 commented Jan 22, 2024

This issue is too broad and there is no clear error cause, therefore I'm closing it

If you're having issues with oauth you can also use browser auth: https://ytmusicapi.readthedocs.io/en/stable/setup/index.html

The settings file to edit is at %APPDATA%\spotify_to_ytmusic on Windows, in ~/.cache on Linux

@sigma67 sigma67 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 22, 2024
@Daniel-GabrielN
Copy link

I have encountered the same issue and solved it by deleting the second channel and then pasting the link https://www.google.com/device?user_code=XXXX-XXXX into a private window.

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

No branches or pull requests

6 participants