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

Oauth #353

Closed
ghost opened this issue Jan 20, 2021 · 18 comments
Closed

Oauth #353

ghost opened this issue Jan 20, 2021 · 18 comments

Comments

@ghost
Copy link

ghost commented Jan 20, 2021

I installed the app on manjaro linux
i got the api like the steps but i am unable to get the auth client id and client secret
can u plz help?
also on the app there is a login to youtube oauth link but it doesn't open or forward to browser for login
help needed!! :(

@trizen
Copy link
Owner

trizen commented Jan 20, 2021

In order to log in, replace CLIENT_ID and CLIENT_SECRET with your native client ID and client secret values, by creating a new OAuth 2.0 Client ID here: click "Create Credentials" > "OAuth client ID", then select "Desktop app".

I attached below some screenshots for guidance:

  1. Select the corresponding project name, then click "+ Create credentials"
    2021-01-20-141733_1920x1080_scrot

  2. Select "Oauth ID"
    2021-01-20-141744_1920x1080_scrot

  3. Select "Desktop app"
    2021-01-20-141805_1920x1080_scrot

  4. Click "Create"
    2021-01-20-141820_1920x1080_scrot

  5. Copy the client ID and client secret values and place them into the api.json file.
    2021-01-20-141837_1920x1080_scrot

  6. The ~/.config/youtube-viewer/api.json file should look something like this:
    2021-01-20-143056_1920x1080_scrot

@trizen trizen closed this as completed Jan 20, 2021
@ghost
Copy link
Author

ghost commented Jan 20, 2021

on step 3 it asks for me to configure the consent screen
image

if i click it
image

i choose external then create and then stuck

@trizen
Copy link
Owner

trizen commented Jan 20, 2021

Select "External", then "create". Choose a random app name and everything should be set up. No need to send the app for review.

2021-01-20-152519_1920x1080_scrot

2021-01-20-152546_1920x1080_scrot

@ghost
Copy link
Author

ghost commented Jan 20, 2021

do i do anything here?

image

@trizen
Copy link
Owner

trizen commented Jan 20, 2021

@ghost
Copy link
Author

ghost commented Jan 20, 2021

do i add test user?
edit: i didn't
after complete consent screen i could make the client id and secret
Thanks a lot

edit2:
showing this when i try to connect my account
image

@trizen
Copy link
Owner

trizen commented Jan 20, 2021

It looks like you sent the app for review. Undo that if you did.

See also: https://www.videoconverterfactory.com/kodi/youtube-api-key.html

If everything is OK, you should be able to log in, as illustrated in the following screenshots:

2021-01-20-155938_1920x1080_scrot

2021-01-20-154554_1920x1080_scrot

2021-01-20-154602_1920x1080_scrot

2021-01-20-154611_1920x1080_scrot

2021-01-20-155126_1920x1080_scrot

2021-01-20-155515_1920x1080_scrot

@ghost
Copy link
Author

ghost commented Jan 20, 2021

yes got it to work
thanks!

@PalanixYT
Copy link

guys can you help me? i did everything just like you did, and it worked, but there is just one problem. i can't click the link to get the authentication code. when i click it, nothing happens

@trizen
Copy link
Owner

trizen commented Feb 13, 2021

Try right-click -> "Copy URL", then paste the copied URL into a browser.
2021-02-13-034724_1920x1080_scrot

@PalanixYT
Copy link

sadly that doesn't work. i have tried it using all gtk versions. could it be because of wayland?

@trizen
Copy link
Owner

trizen commented Feb 13, 2021

Not sure, but double-check the api.json file (see the 6th point from #353 (comment)).

If everything looks alright, then you can try to log-in from the CLI version:

youtube-viewer --login

@PalanixYT
Copy link

Can't locate object method "history_list" via package "Term::ReadLine::Stub" at /usr/bin/vendor_perl/youtube-viewer line 655.

@trizen
Copy link
Owner

trizen commented Feb 13, 2021

It seems that you don't have the Perl module Term::ReadLine::Gnu installed.

Either install Term::ReadLine::Gnu, or set history => 0 in the configuration file of youtube-viewer (~/.config/youtube-viewer/youtube-viewer.conf).

@PalanixYT
Copy link

thanks man it worked

@zensubz
Copy link

zensubz commented May 1, 2022

I think YouTube/Google has recently made some changes, the above tips aren't working for me now. It is asking for Developer Contact, domain name etc., and also forces one to apply for 'project review/verification', thereby making it complicated. This has happened the moment I enabled this scope: https://www.googleapis.com/auth/youtube.force-ssl. Here is the screenshot of the login-error:
gtkyt_error

I request @trizen to look into this issue and give the solution. Thanks.

trizen added a commit that referenced this issue May 1, 2022
Potential solution to: #353 (comment) and #415 (untested)

More info on this issue:

	https://developers.googleblog.com/2022/02/making-oauth-flows-safer.html
	https://developers.google.com/identity/protocols/oauth2/native-app

Alternatively, we may try "TV and Limited-Input Device Applications":

	https://developers.google.com/identity/protocols/oauth2/limited-input-device

However, this does not support posting comments.
@zensubz
Copy link

zensubz commented May 1, 2022

Thanks @trizen for the work on aab839b. This time I could go a bit further, allow the app to gain access, but after that it doesn't redirect, I have attached the screenshots below:
ytv_access
ytv_error

Am I missing something..?

trizen added a commit that referenced this issue May 8, 2022
…". (fixes #415 and #353 (comment))

The new mechanism uses the following scope:

	https://www.googleapis.com/auth/youtube

This scope is a bit more limitted than the previous supported scope (`https://www.googleapis.com/auth/youtube.force-ssl`).

It still allows liking and dislking videos, adding videos to favorites, viewing your playlists, etc.

One important difference is that this scope does NOT support posting comments.

For more info, see: https://developers.google.com/identity/protocols/oauth2/limited-input-device

Users that are already logged in, there is no need to logout. Everything will work as before.

Also updated the README with updated info for logging in: https://github.com/trizen/youtube-viewer/#logging-in

The OAuth client ID now needs to be of type "TV and Limited Input devices".
@iwbcman
Copy link

iwbcman commented Dec 23, 2023

Just wanted to mention, https://developers.google.com/identity/protocols/oauth2/limited-input-device#creatingcred worked for me

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

4 participants