Step 1: Go to Google API Console and log in with your Google account.
Step 2: Click on YouTube Data API
Step 3: Click on Enable:
Step 4: Click on Credentials in the left hand menu and the click on the Create Credentials drop down and select API Key
Step 6: Copy your new API Key (when you past in the key make sure there are no spaces at the beginning or end)
YouTube API Issues