plugin.video.youtube
plugin.video.youtube copied to clipboard
Instructions for creating an API key and OAuth credentials
Hi, On the Personal API Keys wiki page , the tutorial video for generating API keys is down : "This video has been removed for violating YouTube's Terms of Service" Video URL : https://www.youtube.com/watch?v=4iFaY8IpTeI Currently, there is no other explanation than this video tutorial in the wiki unfortunately.
Thank you for this amazing Kodi plugin :heart_eyes:
Here are my 2 cents for this issue.
I found this great video explaining the process, unfortunately it's in French 😁 . I figured it might be useful to some, though, so here it is:
>>> https://www.youtube.com/watch?v=kKMFH5SwyNw <<<
As a complement, here is a small written tutorial with the steps.
API Key Creation
- Go to https://console.developers.google.com/ and create a new project
- Click on
Activate APIs and Services
- Activate
Youtube Data API v3
-
Go to the
Credentials
section and clickCreate new credentials
-
Create a new credential of type
API Key
. Choose a name, and leave the restriction choices toNo restriction
- Create a new credential of type
OAuth client Id
- Choose
External
user type
- Choose any name for the App. Select your email address in the list. Leave all the other options to the default.
- Create a new credential of type
OAuth client Id
, again
- Choose
TV input devices and limited
as application type, and leave the client name to default
- Go to the
OAuth consent screen
section, and click thePublish
button to publish you app
Alternatively you can add your Account as a Test User, thereby allowing access. By default nobody (not even the account owning the project) has access.
Kudos to https://github.com/anxdpanic/plugin.video.youtube/issues/312 for this method
- Back to the
Credentials
page, you should now have access to all 3 required keys
- To get the
Client secret
, you need to edit the OAuth credential. This should open a popper window including the secret.
Configure the Add-on
Follow the instructions in the wiki section: https://github.com/anxdpanic/plugin.video.youtube/wiki/Personal-API-Keys#configure-the-add-on
Sign In
During the add-on Sign in process you'll be asked to Connect a device
twice.
The second time you Connect a device
, you will be prompted with:
This app isn't verified
This app hasn't been verified by Google yet. Only proceed if you know and trust the developer.
From there clicking Advanced
and Go to <your project name> (unsafe)
allows you to complete the process.
This should be it! 🎉 🎉 🎉
Additional notes
I have noticed that I had to run the whole Sign In
process a second time after I exited Kodi and started it back again, i.e. perform the Connect a device
action 4 times total.
(this may be related to https://github.com/anxdpanic/plugin.video.youtube/issues/388)
But the good new is, after all this, Kodi now finally remembers my account each time I start it up 🎉 🎉 🎉
I hope this little guide will be helpful to some of you, and why not, could help updating the wiki 😇
just reupload it to other service. Vimeo, Odysee or other
Thanks for the detailed guide @slax57! ❤️
I also found this guide helpful for those looking for english screenshots.
Is there any fix to make this work if you have 2 factor authentication enabled on the account?
What doesn't work when you have 2FA enabled?
You need to authenticate account access via a browser to grant Kodi the OAuth access token, and it is only when you login in the browser that you would need to provide the details for the 2FA.
Unless something has changed?
What doesn't work when you have 2FA enabled?
You need to authenticate account access via a browser to grant Kodi the OAuth access token, and it is only when you login in the browser that you would need to provide the details for the 2FA.
Unless something has changed?
I am getting a 400 invalid_token error
The error is fairly self explanatory - it means that the token you are using is not valid.
This usually will happen when you created the wrong type of token, or are using an old token that is no longer valid that causes the revoke endpoint to return this error when trying to refresh the access token.
This is just a guess because you are not really providing any useful details to diagnose what the problem could be.
You should create a new project/API key with the proper scope, and create new credentials. Enter the new API key details into the addon settings and try signing in again.
If you are still having the same problem create a new issue with full details and a debug log.
I reset every page of the addon settings to default and still same error. My token is years old. I will try and create new credentials and try again
My token is years old.
Yeah that is the likely cause, they can be revoked due to lack of use, change in scope, on Google's whim, etc.
Just to be sure, make a new API key as well, not just new credentials for an old key.
ok I redid the auth and had to log in twice. Seemingly successful. But I get:
error <general>: [plugin.video.youtube] Error reason: |quotaExceeded| with message: |The request cannot be completed because you have exceeded your quota.|```
Hard to see how that's possible given I only just got it auth'ed
I also get list for my Subscriptions.
Here is my log
https://1drv.ms/t/s!An_0ZtrQyrRIhMI_aOKx5ldky-PyGA?e=axfKnn
The log is a little strange. You only seem to have logged out and logged back in 7 minutes before closing Kodi, but the quota exceeded errors were occuring well before that.
It almost sounds like your API key has been disabled, but you didn't create a new API key, just a new valid OAuth credential for the existing disabled API key, which is why you are no longer getting the invalid_token_error but the quotaExceeded error instead.
It is not uncommon for this to occur which is why I recommended creating a new API key, not just a new OAuth credential.
ok I redid the auth and had to log in twice
If you are absolutely sure you created a new API key before this, then one thing to check is to go to https://console.cloud.google.com/apis/api/youtube.googleapis.com/quotas and check what your quota allocaton and usage actually is. You should see something like the table below:
In some instances a newly created API key may have close to 100% of the daily quota allowance already used, which resets after a period of time (at most one day). Alternatively if you have a disabled API key, you will see that your quote limit is set to zero, and your only option is to create a new API key.
Edit: Also update the addon from here: https://github.com/anxdpanic/plugin.video.youtube/releases/latest v7.0.1 likely won't work even if you do resolve the API key and OAuth login issue. Newer versions may not have those issues at all.
Quota is 0. I did create a new API. I updated yesterday to the new version as well. I'm going to try making a new project etc again....
Hmm that sucks. It happens sometimes for seemingly no reason, and worst of all there is no advance warning either.
I'm going to try making a new project etc again....
Yeah unfortunately creating a new API key is your only option, and creating a new project is probably a good idea too.
I DID create a new API key yesterday as you suggested and today I did the new project and I have a 10000 quota and it's working. Finally. Big thanks for this addon and all your help.
I DID create a new API key yesterday
I'll admit I was suspicious because the process is not straightforward and it is easy to not know the reason/significance of each step, but I do believe you (at least now 🙂).
Why it happens, even for a new API key, is something only Google can answer, but it's good you got it working despite the hassle.
Yeah i had it working years ago before I switched to using 2FA and it hasn't worked since. It was on the backburner but made it to the front now….