Skip to content

Commit

Permalink
Add optional parameters for OAuth client ID and secret to setup
Browse files Browse the repository at this point in the history
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
  • Loading branch information
fischcode committed Dec 13, 2024
1 parent 9ce284a commit 980e1c5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ytmusicapi/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ def parse_args(args):
parser = argparse.ArgumentParser(description="Setup ytmusicapi.")
parser.add_argument("setup_type", type=str, choices=["oauth", "browser"], help="choose a setup type.")
parser.add_argument("--file", type=Path, help="optional path to output file.")
parser.add_argument("--client_id", type=str, help="optional Google OAuth client ID.")
parser.add_argument("--client_secret", type=str, help="optional Google OAuth client secret.")

return parser.parse_args(args)

Expand All @@ -69,6 +71,6 @@ def main():
filename = args.file.as_posix() if args.file else f"{args.setup_type}.json"
print(f"Creating {filename} with your authentication credentials...")
if args.setup_type == "oauth":
return setup_oauth(filename, open_browser=True)
return setup_oauth(filename, open_browser=True, client_id=args.client_id, client_secret=args.client_secret)
else:
return setup(filename)

0 comments on commit 980e1c5

Please sign in to comment.