Difference between revisions of "How to setup the YouTube API Key for video embedding"

From JReviews Documentation
Jump to: navigation, search
Line 1: Line 1:
 
Starting with version 3, the YouTube Data API now requires the use of a key to request video information so this means that it's necessary to setup the API Key in the JReviews Media Settings, Videos tab to make YouTube video embedding work.  
 
Starting with version 3, the YouTube Data API now requires the use of a key to request video information so this means that it's necessary to setup the API Key in the JReviews Media Settings, Videos tab to make YouTube video embedding work.  
 +
 +
__TOC__
  
 
=Creating a YouTube API Key=
 
=Creating a YouTube API Key=

Revision as of 12:27, 4 August 2019

Starting with version 3, the YouTube Data API now requires the use of a key to request video information so this means that it's necessary to setup the API Key in the JReviews Media Settings, Videos tab to make YouTube video embedding work.

Creating a YouTube API Key

  • Go to https://console.developers.google.com and create a new project for your site. We are calling it MySite in our example.
  • Click Enable and manage APIs, then search for youtube and select the YouTube Data API v3
  • Click the Enable API' button at the top and wait for the API enabled notification to appear
  • Click the Credentials link in the left sidebar, then the blue Add credentials button and select the API Key option.
  • You will get a Key in a popup. Close the popup and click on the key to give it a name, and copy the generated API Key to the JReviews Media Setting for the YouTube API Key
  • Do not add a restriction to the key at this time, because that could very well prevent it from working if not done correctly. It's better to test the key first outside and inside JReviews.

Testing the YouTube API Key outside of JReviews

After generating your key give it a few minutes to make sure it becomes active. Then you can test if your key is working using the following URL. Just replace the example key with your own key.

https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails&id=-DIJvggBrg8&key=AIzaSyBo5K8oolb6LnpAUMAsoAKIpoXxGybaOi0

Adding a Restriction

  • Optionally, an IP address of your server can be added as Key restriction, although it is recommended to try the key before setting the restriction. Do not use an HTTP referrer restriction because the key is only ever used to make requests at the server level and an HTTP restriction will not work.


Watch the Video Tutorial

Watch in HD on YouTube

YouTube Embedding Stopped Working

YouTube has begun to disable inactive keys, those not used for some time. They do this by setting the usage quota limit to zero and preventing you from changing it. The only way to overcome this is by creating an entirely new project and repeating the steps above. Creating a new key within the same project doesn't work because the project has the quota limit set to zero and any new key you create will be automatically limited.