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

LoginException: [401] invalid_client: Invalid client type #157

Closed
betatester3016 opened this issue Jun 19, 2021 · 26 comments
Closed

LoginException: [401] invalid_client: Invalid client type #157

betatester3016 opened this issue Jun 19, 2021 · 26 comments
Labels
bug Something isn't working

Comments

@betatester3016
Copy link

betatester3016 commented Jun 19, 2021

Context

Please provide any relevant information about your setup

  • Add-on Version: 6.8.14 and 6.8.15 (possible other versions, not tested)
  • Kodi Version: Kodi-19.1
  • Kodi GUI Language: English
  • Operating System: CoreELEC (official): 19.2-Matrix_rc2 (arm) / LibreELEC (official): 9.95.4 10.0 (x86)
  • Operating System Language: English

Expected Behavior

Clicking sign in should bring up a window to enter user credentials.


Current Behavior

Clicking sign in shows: LoginException: [401] invalid_client: Invalid client type.


Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. Install CoreELEC or LibreELEC Matrix Edition (Kodi 19.1)
  2. Install YouTube addon v6.8.14 or 6.8.15
  3. Sign in with YouTube addon sign in option.

Log

CoreELEC (arm):
http://ix.io/3qt3

LibreELEC (x86):
http://ix.io/3qtc


@betatester3016 betatester3016 added the bug Something isn't working label Jun 19, 2021
@anxdpanic
Copy link
Owner

This means there is an issue with your keys. Can't really be more specific, might be entered incorrectly or might require recreating keys.

@betatester3016
Copy link
Author

Thanks, for some strange reason my original API keys were allowing me to play content, but not to log in. I ended up having to re-create the keys.

@teodoryantcheff
Copy link

@anxdpanic is right -- Just making a new set of keys seems to fix this.

@Mentor1337
Copy link

I'm on my 4th set of keys with no luck. Same error.

@betatester3016
Copy link
Author

betatester3016 commented Oct 30, 2022

Usually it's a typo. To ensure no typos occur, the easiest way is to enter the keys via copy & paste:

In Kodi Youtube Addon Settings:

  • Turn ON Enable API Configuration Page

With a web browser:

  • Access the API page using the url <kodi IP>:50152/API
  • Copy the 3 keys over and save

Here's a video tutorial on how to create a new key. This method worked for me.

@Michal-Szczepaniak
Copy link

@Mentor1337 same here, its not working with known working set of keys

@THRobinson75
Copy link

THRobinson75 commented Nov 13, 2022

Same... did a full reset of my media player and was messing around with settings, renaming files etc, and when came to install YouTube I was hit with this. Finally had to go and blow away everything online and recreate the project/api to get it working again.

Finally when I was done and everything worked how I wanted, I formatted my SD card and reinstalled everything for a fresh start. Got to YouTube and right back to this error again. Blew away and recreated API stuff 3-4x and getting this error after my first verification attempt. Did exactly what I did yesterday and same deal. I did see something saying about maybe taking 5min-1h to work, so, will watch a movie and try again after.

Not sure what changed but WOW this thing is finicky... use to do this all the time nice and easy, but this time it's been a struggle.

@betatester3016
Copy link
Author

Once you have working keys, keep a copy of api_keys.json handy. If all fails, simply drop the copy in the corresponding folder and reboot. The file is located in ~/.kodi/userdata/addon_data/plugin.video.youtube

@Onezille
Copy link

I had the same issue.
Solved it by selecting TVs and Limited Input devices as an Application type when creating OAuth client id.

@Mentor1337
Copy link

@betatester3016 Well, it ended up being a real PITA, since the local HTTP server would not even try to start, so I was unable to enter the API info that way. OSMC I was able to get the API page to start without issue, but using Libreelec, it shows listening IP's as 127.0.0.0 and 0.0.0.0. Even manually adding the device's IP did not broadcast the page, so I could not get it to work.

@Michal-Szczepaniak However, I was able to get the API key to work. I had to take the app out of the testing branch and publish the app under OAuth Consent Screen. Not sure if it is a security measure or a setting on my account since others are able to use it while in the testing phase. There is also dual login; after verifying the device once, a second verification code appears, and you need to activate it a second time, and you should be good!

To ensure no typos without HTTP, either use My Phone/Join to allow your phone and computer clipboards to sync or open Google Dev Console page on your phone and pull up your API info. Use Yatse app on your phone for controlling Kodi, and copy/paste the info in that way.

@THRobinson75
Copy link

Well... it's working. On a whim I did exactly what I did the last time and not sure why but worked.

Basically uninstalled it, and installed 6.8.18 from zip. I used my PC to copy/paste the API over so absolutely no typos. FAIL.

Then, I click update and let YouTube auto update to 6.8.20. Checked and API's were still there. So went into the verification and worked fine.

So... yeah. I mean I tried waiting a few hours and still failed, blew away the project and recreated multiple times and failed. But both times I tried installing 6.8.18, adding API's, FAIL, then update to 6.8.20 through the Kodi repository, then trying verification again, WORKED.

@betatester3016 ... I don't think I can. I am using CoreElec, which doesn't really have an OS. I'm not sure how to drop the file into the directory you mentioned. When I use to run Win7 with Kodi on PC, no problem, but I'm using an Android box now with an SD card that bypasses Android and (from my understanding) has the absolute bare minimum of Linux/Unix running, just enough to boot Kodi.

@betatester3016
Copy link
Author

@THRobinson75 nothing to do with CoreELEC, everything to do with where Kodi stores its files. Keep api_keys.json with working keys handy on a USB Flash Drive.

@THRobinson75
Copy link

@betatester3016 ... So, if I have the file on USB, how do I copy it to where it needs to go within Kodi? Just through file manager? Will it overwrite files if in use?

I don't play with Kodi much. I install it, link to my NAS and fight with YouTube. I don't even change the skins. 😅

Probably a lot of good stuff and add-ons but years and years ago when I started using it, so much of it was kinda flakey and of no use to me so just left it at essentially default settings.

@betatester3016
Copy link
Author

@THRobinson75 Like this.

@mmBesar
Copy link

mmBesar commented Nov 30, 2022

I had the same issue. Solved it by selecting TVs and Limited Input devices as an Application type when creating OAuth client id.

@Onezille
Thank You.
Have a great day.

@Michal-Szczepaniak
Copy link

I literally had selected TVs and it didn't change anything

@THRobinson75
Copy link

Only way it worked for me, and no idea why, was to

  • install 6.8.18 from zip file
  • do everything you're supposed to do, and it will fail
  • update from KODI repository to 6.8.20
  • run authentication part (through Google) again and works

Again, no idea why it worked but I replicated this twice and both times it's the only way I could get things to authenticate.

@betatester3016
Copy link
Author

Just through file manager? Will it overwrite files if in use?

Yes and yes.

@mail02ankit
Copy link

I had the same issue. Solved it by selecting TVs and Limited Input devices as an Application type when creating OAuth client id.

The same solution worked for me.

@Lieta2
Copy link

Lieta2 commented Aug 2, 2023

I had the same issue. Solved it by selecting TVs and Limited Input devices as an Application type when creating OAuth client id.

The same solution worked for me.

Didn't work for me. After second verification code it shows an error that the application is being tested and that only authorized testers can access it. If you require access, contact developer.
EDIT:
I was able to sign in by adding myself to the testers. However I still can't play some videos. It shows error: "This video is not available". Can play the same videos from browser.

@mm1992
Copy link

mm1992 commented Aug 3, 2023

I had the same issue. Solved it by selecting TVs and Limited Input devices as an Application type when creating OAuth client id.

Thanks, it has worked for me as well.

@rpatterson
Copy link

My YouTube plugin is now working again but I didn't change anything from my attempts to get it working last night. Last night I renewed/replaced the "OAuth 2.0 Client ID" and "OAuth 2.0 Client Secret", AKA the "API Id" and "API Secret" in Kodi settings but it still didn't work. So I also renewed/replaced the "API Key" but it still didn't work and I gave up for the night. Tonight I didn't change anything and tried again and playing YouTube videos now works.

Then I remembered that when I was renewing/replacing the ID, secret and key, one of them warned that it might not take effect for hours or even a day. Unfortunately I don't remember which and I'm not going to break it again. But maybe this could be the reason why others have reported getting it to work but not understanding what they did differently from other attempts that didn't work.

@MoojMidge
Copy link
Collaborator

@rpatterson - thanks for providing that insight. There are a few odd things that can occur with this whole process, will have to keep this one in mind too.

@deyantodorov
Copy link

deyantodorov commented Mar 17, 2024

Finally, works for me here are the steps:

  1. Install it via official repository or zip by cloning repo
  2. Create YouTube Data API v3 in Google Cloud
  • API Key
  • OAuth Client ID
  • OAuth Client Secret
  1. Enable YouTube plugin remote access via Setting -> API and then configure IP via Advanced and for try to access it on address:
    http://192.168.1.123:50152/youtube/api/. If it doesn't work something is not configured.
  2. On the screen from step 3 paste you API Key, OAuth Client == API Id, OAuth Client Secret == API Secret.
  3. You can verify it is successful by checking on Add-On Setting -> API and you should see your values there. If you don't something is wrong with the safe.
  4. NOW. THE IMPORTANT PART switch Add-On user profile to your gmail (for example: name.lastname@gmail.com) account otherwise you will receive always 401 error. At least this was the case with myself.
    Thanks!

@mattiasb
Copy link

I had the same issue.
Solved it by selecting TVs and Limited Input devices as an Application type when creating OAuth client id.

So instead of just signing in via "Sign In" in the YouTube app on Kodi you first go to Google and make a fresh OAuth client in some way? Did I understand that correctly? If yes: could you point me to where?

@ltai0001
Copy link

I had the same issue.
Solved it by selecting TVs and Limited Input devices as an Application type when creating OAuth client id.

So instead of just signing in via "Sign In" in the YouTube app on Kodi you first go to Google and make a fresh OAuth client in some way? Did I understand that correctly? If yes: could you point me to where?

yes correct - go to https://console.cloud.google.com/ then to Dashboard then to API overview then credentials (on the left side) then create a new OAuth Client IDs (no need to delete the old one) and choose "TVs and Limited Input devices " as type. Once the set of keys are created copy paste into kodi youtube addon.
I kept the API key the same so just updating to the new OAuth Client ID + Secret worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests