Youtube API, key not working - youtube-api

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

Related

GET request in google drive api with api key

According to the google drive api's documentation, I can not write key parameter into the request.
I tried this request with my folderID and my api key:
GET https://www.googleapis.com/drive/v3/files?q='folderID'+in+parents&key={API KEY}
The documentation page contains a try-out method where I tried out my request, I ticked only the API key in the credentials section. This also did not work.
Can I make requests with api key or not?
API keys are used for accessing public data. Not private user data.
The files.list requires that your application be authorized with one of the following scopes
trying to call files.list without authorizing the call using Oauth2 is going to result in the following error message
{
"error": {
"errors": [
{
"domain": "global",
"reason": "insufficientFilePermissions",
"message": "The user does not have sufficient permissions for this file."
}
],
"code": 403,
"message": "The user does not have sufficient permissions for this file."
}
}
The only method in the google drive API that you would be able to use with an API key would probably be a file.get assuming that the file itself was set to public. As in shared with everyone.
Api keys are mostly used for apis like maps, or youtube searching for public videos.

how to get the permission of the youtube analytics api for a channel

my fellow created a project at google console, and he can always use the youtube analytics api to query a specific channel through oauth. Then he appointed me as an owner of the project, but when i used the same parameter to query the analytics api, it said i had not permission, as follow:
403
- Show headers -
{
"error": {
"code": 403,
"message": "Forbidden",
"errors": [
{
"message": "Forbidden",
"domain": "global",
"reason": "forbidden"
}
]
}
}
I think it's because i have no relative permission for these channel. but i have no idea how to get the permission of the youtube analytics api for a specific channel.
And i am confused that how is the project which is created in the google console associated to a youtube channel? Is't by the account who creates them?

Not able to get Google Signin Profile Image in IOS

I have followed the instructions in this URl and get the userid, name and email but image information is not having. Please suggest your feedbacks.
https://developers.google.com/identity/sign-in/ios/people
Also use this url to get image https://www.googleapis.com/plus/v1/people/115950284...320?fields=image&key={YOUR_API_KEY} but it says
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "ipRefererBlocked",
"message": "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 API key configuration if request from this IP or referer should be allowed.",
"extendedHelp": "https://console.developers.google.com"
} ], "code": 403,
"message": "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 API key configuration if request from this IP or referer should be allowed."
} }
You could use the server API and write not just IP of the server but also IPv6. This helped me with the same issue.

Youtube API with AFNetworking failed

I am trying to use the Youtube API to pull in all the videos from a particular channel. I set up the project in Google Developers Console and got an API browser key. I enabled YouTube Data API v3 and for safe measure, I enabled YouTube Analytics API.
I do not know what I am getting this error. Can anyone help me. This is my console output.
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "ipRefererBlocked",
"message": "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 API key configuration if request from this IP or referer should be allowed.",
"extendedHelp": "https://console.developers.google.com"
}
],
"code": 403,
"message": "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 API key configuration if request from this IP or referer should be allowed."
}
Did you add any bundle id's to "Edit allowed iOS apps..." in your API Access panel? If you did, remove them all. iOS apps: should now say "Any app allowed". This fixed this issue for me.
I am told that this is fixed by simply removing all Ip's from the edit allowed IP's option. This makes it so that it is less secure, but it will accept all IP's after that.

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