Insert liveCuePoints in live broadcast - getting error 403 Forbidden - youtube

We have a verified app with the following scopes:
https://www.googleapis.com/auth/youtube.force-ssl
https://www.googleapis.com/auth/youtubepartner
https://www.googleapis.com/auth/youtube
This means we can use the YouTube Data API and YouTube Content ID API (for YouTube Partners).
We are trying to do ad inserts (insert LiveCuepoints) for a live broadcast on a YouTube partner channel, which is connected via our verified app. We are getting the following error when we use the LiveCuepoint insert API endpoint:
Request
POST /youtube/partner/v1/liveCuepoints?channelId={channelId}&onBehalfOfContentOwner={contentOwnerId} HTTP/1.1
Authorization: Bearer {accessToken}
Content-Type: application/json; charset=utf-8
Host: www.googleapis.com
Content-Length: 57
{"broadcastId":"{broadcastId}","settings":{"cueType":"ad"}}
Response
{
"error": {
"code": 403,
"message": "Forbidden",
"errors": [
{
"message": "Forbidden",
"domain": "global",
"reason": "forbidden"
}
]
}
}
Other requests (with the same credentials) to the YouTube Content ID API (such as listing contentOwners or listing liveBroadcasts) are working fine and without errors.
We’ve tried debugging this issue for many hours, researched online and tried different solutions but couldn’t get this to work. Is there a special scope, setting or access needed to do ad inserts in a live broadcast? Is anyone having working example code to do liveCuepoint inserts?

For anyone interested: I found the solution.
We connected (via our verified app) as a channel. This was a mistake, you have to authenticate with an account, and this account must have administrator rights.
Now you receive an access token which can access all content owners and channels connected to that account. Inserting liveCuePoints now works fine!

Related

HTTP 400 for graph /sites endpoint - Error authenticating with resource

I'm getting an HTTP 400 on a request for https://graph.microsoft.com/v1.0/sites?search=* but expected response is an HTTP 200 w/ data.
It works successfully in multiple client environments (i.e. 100s of environments), but it doesn't work for one of our clients.
The application does successfully return calls for /groups, /domains, and other endpoints prior to hitting this HTTP 400.
The error is:
Error authenticating with resource
Response from remote side is:
{
"code": "AuthenticationError",
"message": "Error authenticating with resource",
"innerError": {
"request-id": "1d68c066-dba8-487e-b3a8-bd77f517d394",
"date": "2019-06-25T18:50:31"
}
}
I'm not sure the next steps from here. HTTP 400 suggests a malformed request, but I'm guessing this should actually be an HTTP 403 or 401 response instead of a 400?
Not sure how to resolve, please let me know, thanks!
edit: request-id added back in
If you're able to call other resources the same way (i.e. /groups), it would suggest a lack of permissions. Be sure the app or user authenticating has the required permissions:
Delegated (work or school account): Sites.Read.All, Sites.ReadWrite.All
Delegated (personal Microsoft account): Not supported.
Application: Sites.Read.All, Sites.ReadWrite.All
Documentation here

Getting error code 200 for google assistant on Raspberry pi 3

I am getting the following errors:
https://embeddedassistant.googleapis.com/v1alpha2/projects/rpiassistant-f01c3/devices/B65EF05D34859770BDEBF646E84D89F1 200
ON_MUTED_CHANGED:
{'is_muted': False}
ON_START_FINISHED
[2509:2526:ERROR:http_client_with_backoff.cc(113)] Retrying request with http_status=200 request_id=0
The above URL returned as follows:
{
"error": {
"code": 403,
"message": "The request is missing a valid API key.",
"status": "PERMISSION_DENIED"
}
}
Please note that I have enabled the API still getting this error please help
HTTP status code 200 is not an error. Rather, it is an indication that the HTTP request was successful.
When the sample is making that call, it includes authorization that tells the Google Assistant SDK server that it is you making this request. When you just open it up in a browser, the server doesn't know it is you and returns a 403 for unauthorized access.
AFAIK, this is working as intended and you should be able to run the sample without issue.

Youtube API, key not working

I'm using Google API to develop a web app, to do this I need to interact with youtube and get the channel ID. According to google documentation I use this request
https://www.googleapis.com/youtube/v3/search?part=snippet&q=LorenzoSchaeffer&type=channel&key={YOUR_API_KEY}
where in "YOUR_API_KEY" I copy and paste my API Key found in the google developer console. but I get this response
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "keyInvalid",
"message": "Bad Request"
}
],
"code": 400,
"message": "Bad Request"
}
}
while from google API explorer I get the correct output.
I don't know how to proceed, any solution?
This means either you're using the wrong API key or the API project that "owns" the API key you are using doesn't have the YouTube Data v3 API hasn't been activated for use with the project.
Go here for information on how to get started, get and API key (make sure to get an API key and not OAuth credentials): https://developers.google.com/youtube/v3/getting-started

I am getting a 403 error: "domain": "usageLimits", "reason": "ipRefererBlocked", in YouTube Data API v.3

I am getting a 403 error:
"domain": "usageLimits", "reason": "ipRefererBlocked", in YouTube Data API v.3
With the following call:
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet%2CcontentDetails&maxResults=50&playlistId=PLSnMNeASC5B5RBEBJClz6DdLEa-W9TM7t&key=AIzaSyAplIcFznd1OxBaMWM2LBN9uLBOVITMYxs
Also tried
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet%2CcontentDetails&maxResults=50&playlistId=PLSnMNeASC5B5RBEBJClz6DdLEa-W9TM7t&clientId=200447294473-i5a20md5sgpq20mai9ob2tiib8nqln9t.apps.googleusercontent.com
and getting this error:
"domain": "usageLimits",
"reason": "dailyLimitExceededUnreg",
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",
"code": 403,
API and credentials are authorized and within daily quota, intact, below 0.07/sec/day.
Could you please provide some assistance?
I was facing similar issue while integrating to wordpress. Below listed are the fix/ mistakes I made, may help you.
ensure YouTube API is enabled
initially remove any domain restrictions from "Accept requests from these HTTP referrers (web sites)". later once its working u can add DOMAIN name
generate and use "browser" type key if integrating to website.
You need to change/set Browse key instead of android Key.
Also you need to checked the section Accept requests from these HTTP referrers (web sites) from Google Developers Console > API Manager > Credentials
to accept all requests from your website(or domain) add this lines to Website restrictions area in google cloud api restriction screen
Any subdomain or path URLs in a single domain, using wildcard asterisks (*):
*.example.com/*
http://*.example.com/*
https://*.example.com/*

Invalid Credentials for OAUTH from Youtube API

I am getting 401 Invalid Credentials error trying to use the Youtube API in the OAuth 2.0 Playground.
Response is:
{
"error": {
"code": 401,
"message": "Invalid Credentials",
"errors": [
{
"locationType": "header",
"domain": "global",
"message": "Invalid Credentials",
"reason": "authError",
"location": "Authorization"
}
]
}
}
Steps can be reproduced here.
Select Manage Youtube account API
Authorize
Get access token
Attempt to call any Youtube API (you may need to plug your own API key in as well)
The access token is valid (non-Youtube API calls work fine) and I have tried this with a number of different accounts which have Youtube accounts and channels set up (so the reply here is not what's happening).
The API works fine in the Try it Now section here so this is quite strange.
Maybe somebody can try these steps with their account and verify if the outcome is the same or not?
You have to choose the "Use your own OAuth credentials" option in the settings of the OAuth Playground (link at the top right corner).
You also need to add the following URL to the list of Redirect URIs of you project in the Developers Console:
https://developers.google.com/oauthplayground
If you do that, you don't need to pass the API key.

Resources