Google API: YouTube video uplaod error = 403

2019-08-03 15:16发布

问题:

I'm getting following error for uploading the video to youtube,

YouTube-API-Demo[654:60b] Video Upload failed : Error Domain=com.google.GTLJSONRPCErrorDomain Code=403 "The operation couldn’t be completed. (Access Not Configured. The API is not enabled for your project, or there is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your configuration.)" UserInfo=0x16e922e0 {error=Access Not Configured. The API is not enabled for your project, or there is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your configuration., GTLStructuredError=GTLErrorObject 0x16daee10: {message:"Access Not Configured. The API is not enabled for your project, or there is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your configuration." code:403 data:[1]}, NSLocalizedFailureReason=(Access Not Configured. The API is not enabled for your project, or there is a per-IP or per-Referer restriction configured on your API key and the request does not match these restrictions. Please use the Google Developers Console to update your configuration.)}

Please help me in resolving the issue.

回答1:

Have you enabled the Youtube Data API for the App that you are using? https://console.developers.google.com/project

You see a list of projects there and you have to active the APIs per project.

Otherwise there might be IP restrictions. You can restrict your App Token to only allow access for specific IPS. The default is "allow all IPs". There is a "Access" Tab somewhere.