If you followed the previous post and started using Kodi, you might be wondering what else you can do with it other than sharing videos over the network. Kodi has great community support and offers many add-ons. One of those add-ons is for YouTube. The setup process can be tricky for some users, so I’d recommend reviewing the pros & cons at the end of the article. Also, skim through the steps involved before you start to have a good idea of what you are getting into.

Let’s get started with the installation.

Part 1: Install YouTube Add-On on Kodi

Step 1: Select Add-ons on the left menu.

Kodi add-ons screen

Step 2: Click the Enter add-on browser button in the middle of the screen.

Add-ons showing the menu

Step 3: Scroll down and click on the YouTube add-on.

Video add-ons with YouTube selected

Step 4: Click the Install button at the bottom right of the screen.

YouTube add-on properties with Install button highlighted

Step 5: If prompted to install additional add-ons such as InputStream Helper, click OK.

Dialog box asking to install additional add-ons

Step 6: Wait for the installation to complete.

YouTube installation in progress

Step 7: When prompted to Execute setup-wizard, select Yes.

Dialog box asking to execute setup wizard
  • Select your language and region
  • Decide if you want to perform geolocation. This is used in My Location settings.

Step 8: You should see a checkmark next to the YouTube add-on indicating that it has been successfully installed.

YouTube installation complete

Step 9: Test your installation by clicking on Add-ons on the left menu and YouTube add-on. You should see a home screen like this:

YouTube add-on main screen

Now that you have the YouTube add-on running on your Kodi let’s set up your Google account to generate API keys.

Part 2: Create YouTube API Keys

YouTube add-on requires you to enter your own API keys. This way, all the API calls the add-on makes will be made with your keys.

Step 1: Sign in to Google Cloud Platform with your Google account (If this is your first time, agree to the Terms and Conditions and continue).

Google Cloud Terms of Service agreement screen

Step 2: Click the Create Project button at the top right:

Create Project in Google Cloud

Step 3: Give your project a descriptive name and click Create.

Enter a Project Name

Step 4: Click APIs & ServicesLibrary on the left menu

Step 5: Search YouTube Data API in the API Library and select the first item in the auto-complete (youtube data api v3 in this example)

Search YouTube Data API

Step 6: Click on YouTube Data API v3 again

Select YouTube Data API v3

Step 7: Click the Enable button

Enable YouTube API

Step 8: Click Credentials on the left menu

Step 9: Click Create Credentials and select API key

Create API key

Step 10: Note down your API key and click the Edit API key button.

Write down API key

Step 11: As per the warning above, the key is unrestricted by default. Click on Restrict key option, select YouTube Data API v3 and click Save

Restrict API usage yo YouTube

Step 12: Click OAuth consent screen on the left menu

Step 13: Select External and click Create.

OAuth consent screen

Step 14: Give a descriptive name to the app, such as Kodi YouTube AddOn and select your email as the User support email.

App name

Then scroll down to the bottom and enter your email address again as Developer contact information, and click Save and Continue.

Developer contact information

Step 14: Click Save and Continue on the Scopes and Test users pages and click the Back to dashboard button on the Summary page.

Step 15: Click Credentials again and Create Credentials. This time select OAuth client ID from the menu.

Create OAuth Client ID

Step 16: Select TVs and Limited Input Devices from the list. give it a name (such as your Kodi instance name) and click Create.

Select application type and name

Step 17: Note down your client ID and client secret. Then, click OK.

Write down OAuth client ID and secret

The next step is to enter the API key and the OAuth credentials in your YouTube Add-On. Since the add-on is running on your Raspberry Pi, entering these long random values is not easy. The easiest way to do that is to enter it by using the HTTP server. In the next part, you will configure your add-on and set up your user.

Part 3: Configure YouTube Add-On

Step 1: Enable the API configuration page by turning it on Settings → API

Enable API configuration page

Step 2: Then, click HTTP server and note the port it’s running on.

HTTP server settings

Step 3: On your computer, go to the URL: http://{Kodi IP}:{HTTP Server Port}/api

You should see a page like this:

API key page

Enter your API key, client ID (as API Id) and client secret (as API secret). Then, click Save.

Success message
Make sure to turn off the Enable API configuration page after you’ve entered your credentials.

Step 4: Now, go back to your Kodi instance and open the add-on. Click Sign In.

Kodi main screen

Step 5: As the message says, you must sign in twice. Click OK to dismiss the message.

Log in twice message

Step 6: You should see a code on your Kodi screen.

Authorization code

Go to google.com/device and enter the code on your computer.

Connect a device screen

Step 7: Select the account to use

Select account to use

Step 8: Click Allow

Allow access

Step 9: You should see a successful connection message

Successful connection message

Step 10: You should see a new code on your Kodi screen. Repeat steps 6 – 9 to authorize the app again. If all goes well, you should now see more items in the YouTube menu, such as My Subscriptions. You can now browse your videos, channels etc. 🎉

Kodi main screen with logged in user

Troubleshooting Second Authorization: 403 Access Denied Error

If you got an error during the 2nd authorization that looks like this

403 access denied error

Then, you have to follow the steps below:

Step 1: Click APIs & ServicesOAuth Consent Screen. Your app should be in Testing status.

Publishing status showing Testing

Step 2: Click Publish App and confirm when asked to Push to Production

Confirmation to push to production

Step 3: Go to google.com/device and enter the code again.

Step 4: You will see a warning message saying Google hasn’t verified this app. Click the Advanced link.

"Google hasn't verified this app" warning

Step 5: Click Go to {YOUR APP NAME} (unsafe) link

Go to app link showing

You should now see on your Kodi screen that you are logged in and see My Subscriptions in the menu.

Part 4: Usage and Review

Congratulations on completing a lengthy setup. See below a list of pros and cons based on the setup and initial usage experience:

Pros & Cons

✅ Pros

❌ Cons

  • Setup is cumbersome
  • User experience could be better

Even though the user experience feels a bit different initially, I hope it will grow on me.

👍 Multiple Users

You can create multiple users and easily switch between the users. You can create a new user by clicking Settings → Users → Add a user. Adding a new user involves Steps 4 – 10 of Part 3.

Add a user screen

Then, you can easily switch between accounts by using the Switch User option.

Switch user menu

Even though you sign in to a different YouTube account, it still uses the same API key to fetch your content, so you won’t have to generate new keys.

Conclusion

Setting up a home lab requires some work and maintenance, but in the end, it’s rewarding as well. In this tutorial, you learned how to install the YouTube add-on on Kodi and how to configure Google API to access your YouTube account. I hope you enjoyed it. See you in the next post.

Categories: media centre