I have a problem with Youtube Api v3. The problem is that wants to obtain information from an uploaded video, when performing Retrieve information for video, I get the error 403 Forbidden.
If I run the url I am using the browser returns Json me with all video data.
Visual Studio Error
Same Url in Browser.
if (videoId != "")
{
// If the video has the same description as a video and uploaded to YouTube, then I have removed that was uploaded earlier and upload the newrequest.Service.QueryClientLoginToken();
//Uri urlVideo = new Uri(String.Format("http://gdata.youtube.com/feeds/api/users/{0}/uploads/{1}", hipoConfig.canal_youtube, videoId)); This is This is the URL of the version 2.0
Uri urlVideo = new Uri(String.Format("https://www.googleapis.com/youtube/v3/videos?id={0}&key={1}&part=snippet", videoId, hipoConfig.clave_api));
Video ExistingVideo = request.Retrieve<Video>(urlVideo);
log.escribirInfoLog("Informacion: El video " + ExistingVideo.VideoId + "se elimina de YouTube para ser sustituido");
request.Delete(ExistingVideo);
Wasn't working for me either, was getting a 403 for accessing the youtube API.
in the 'API Restrictions' on the APIs credentials page added it to restrict to the YouTube ABI, now it's working fine.
Have you tried adding OAuth to authorize your request? Upon checking the code error description in YouTube Data API - Errors:
forbidden (403)
Access forbidden. The request may not be properly authorized.
You can try adding OAuth using this documentation on YouTube Data API Overview as a guide.
If your application will use any API methods that require user authorization, read the authentication guide to learn how to implement OAuth 2.0 authorization.
For me the problem was Youtube API wasn't activated Please check this
Visit the Enabled APIs page. In the list of APIs, make sure the status is ON for the YouTube Data API v3.
So you need to check if Check if youtube API v3 is enabled on your project https://console.developers.google.com/apis/enabled
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With