To generate YouTube API key follow the process –
1. For this, you have to log in to your Google account and go to the Google Developers Console.
2. If you don’t have any project created then click on the CREATE PROJECT link.
If you have existing projects then click on the dropdown menu at the top and then click on the New Project link in the Select a Project popup.
3. On the next screen add your Project name and click the CREATE button.
4. Then select the project from the notification section or you can click on the dropdown menu at the top and select the project from the Select a Project popup.
5. Then click on the + ENABLE APIS AND SERVICES at the top.
6. On that page, search for “YouTube” and select the latest API.
7. On the next screen, click on the ENABLE button.
8. On the next page click on the Credentials from the left sidebar.
9. On the Credentials page, from the top, click on + CREATE CREDENTIALS > API key.
10. Now you’ll see your API key in a popup, click on the copy button to copy the key and save it in a notepad, then click on the CLOSE button to close the popup.
11. You need to restrict the key, to do this click on the three dots beside SHOW KEY and click on Edit API Key.
12. On the next page, select Restrict Key under the API restrictions section.
13. Then from the Select APIs dropdown select the API selected in step 6, i.e. YouTube Data API v3 here, and click OK to select the API. Once done click on the SAVE button.
Now you can use the API key.