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

Add optional parameters for OAuth client ID and secret to setup #688

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

fischcode
Copy link
Contributor

Use your own Google API client ID and client secret in setup by calling ytmusicapi oauth --client_id <your Google API client ID> --client_secret <your Google API client secret> to avoid HTTP 400: Bad Request errors (issue #679 )
See developers.google.com/youtube/registering_an_application for instructions on how to create your own youtube OAuth credentials.

Use your own Google API client ID and client secret in setup by calling
ytmusicapi oauth --client_id <your Google API client ID> --client_secret <your Google API client secret> to avoid HTTP 400: Bad Request errors
Copy link
Owner

@sigma67 sigma67 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for for figuring this out and submitting the PR. However, there are still some more improvements needed:

  • The argparse args you added apply to both setup types, although they don't matter for the browser option. This will lead to a misleading CLI (i.e. try running ytmusicapi browser --help). They should only apply to the oauth option. Since the interface is interactive anyway you could also circumvent this by interactively asking for TV auth (deprecated) or client id/secret (recommended) - then request all the info via input(). Both solutions are valid imo.
  • Deprecate the current TV oauth docs and include info on how it should be done currently. This would mean adding guidance on how to correctly create the ID/Secret via Google Cloud. Could be done in a separate PR

@sigma67
Copy link
Owner

sigma67 commented Dec 15, 2024

Which type of OAuth 2.0 client/id secret are you creating? "TV and limited input" or something else? I'm still getting 401 unauthorized here

nevermind, it does seem to work with that configuration

- Add subparsers for parameters for oauth and browser tokens
- Add help options
- Add a check for presence of both client_id and client_secret if oauth is chosen.
@fischcode
Copy link
Contributor Author

Hi
I added subparsers for oauth / browser and validation if oauth is chosen as requested. Hope this meets your expectations.
However, I am reluctant to write instructions on how to create API keys at this time, as I haven't yet figured out the minimum scope required for all ytmusicapi features to work and Google appears to be in the process of changing the UI for key creation.
Here is one page with instructions ("API Key Creation") that you might want to test and copy into the ytmusicapi documentation if successful: https://github.com/Kuschranada/plugin.video.youtube/wiki/Personal-API-Keys

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