-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Implement YouTube OAuth2 login #1670
Conversation
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
I'll need to check the logging issue you described. A few concerns:
|
|
If there is no expiration - so in theory this only happens once - maybe we just do both (log the message, and attempt to DM the owner). |
@@ -44,6 +45,7 @@ public class Bot | |||
private final PlaylistLoader playlists; | |||
private final NowplayingHandler nowplaying; | |||
private final AloneInVoiceHandler aloneInVoiceHandler; | |||
private final YoutubeOauth2TokenHandler youTubeOauth2TokenHandler; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly a bit of a hacky way of going from the (Lavaplayer) youtube-source logging the details to JDA being ready & DM'ing the owner the details. Feel free to point out better solutions for this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably should (automatically) detect that playback is failing due to the "Sign in to confirm you're not a bot" error and point users to some wiki page on how to sign in
This comment was marked as off-topic.
This comment was marked as off-topic.
I've made a PR that adds a new page to the wiki: #1714 Ideally we'll wanna merge this PR & the docs PR roughly at the same time, as I'm referring to the new wiki page in here:
|
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as off-topic.
This comment was marked as off-topic.
It looks like people are still encountering an error stating "Invalid status code for player api response: 400" that I have to yet look into |
I'm uncomfortable merging this at the moment, as YouTube seems to have begun making sign in via OAuth2 ineffective. |
Google probably has rolled out a fix for this workaround to everyone by now. |
This pull request...
Description
This PR adds a toggle to enable the OAuth2 capability found in the YouTube source manager. It also automatically stores & retrieves the refresh token for convenience of JMusicBot users (as the source manager does not do that itself.)
Quick summary of the login flow
Upon enabling OAuth2 (
youtubeoauth2=true
in the config.txt) the YouTube source manager will log the following:Navigating to https://www.google.com/device and entering the code will lead you to an OAuth2 page
(the source manager pretends to be a logged in TV client to play tracks)
Once allowed, the source manager logs a refresh token. For convenience, JMusicBot intercepts the log with a turbo filter & stores the refresh token as a file,
youtubetoken.txt
. The refresh token will be used when JMusicBot gets restarted to retrieve an access token.Purpose
This should circumvent the "Sign in to confirm you're not a bot" message that people (particularly) on servers have been getting.
Relevant Issue(s)
Fixes #1588
Related PR: #1714
Todo