Youtube API with AFNetworking failed - ios

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.

Related

Google Calendar api authentication via POST request

I am trying to issue a POST request towards the google calendar api, but I fail to understand how to authenticate it.
I took the following steps to try and use a service account to do so:
I've enabled the the calendar api in the Google Cloud console
I've created a new service account, enabled G Suite Domain-wide Delegation, and downloaded the provided key.
I've added the service account email to the calendar to be able to make changes and create events.
I've tried to create a POST request to https://www.googleapis.com/calendar/v3/calendars/calendarId/events with the contents of the JSON key as the value of the Authorization header, but I receive the following error:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Invalid Credentials"
}
}
Am I missing some steps or have I do not understand correctly the authentication process?
I would appreciate your help.
Its not simply a matter of applying the contents of the key file to your call, all google apis need an access token in order to authenticate them.
To get an access token from a service account you need to follow the following steps. Preparing to make an authorized API call
There are steps you will need to complete inorder to get the access token you will need to make a call to the api
After you obtain the client ID and private key from the API Console, your application needs to complete the following steps:
Create a JSON Web Token (JWT, pronounced, "jot") which includes a header, a claim set, and a signature.
Request an access token from the Google OAuth 2.0 Authorization Server.
Handle the JSON response that the Authorization Server returns.
I recommend you pick your favorite server sided programming language and find a client library for it. It will make things much easier then you trying to authncate using a service account by yourself.

Youtube data api return dailyLimitExceededUnreg reach

We are using the YouTube Data API to get the YouTube channel information, it was working before two days now it is giving me below error:
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "dailyLimitExceededUnreg",
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",
"extendedHelp": "https://code.google.com/apis/console"
}
],
"code": 403,
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
}
}
Is there any new update on YouTube Data API?
Can anyone help me to resolve this issue?
In order to access any Google API you need to identify your application. This rule has not been enforced on all Google APIs. If you say your request has worked in the past I suspect that they have begun to enforce this now with the YouTube API.
The problem is that you have either not authenticate your application using Oauth2 or you are not sending an API key along with this request.
You need a Google Account to access the Google Developers Console, request an API key, and register your application.
Create a project in the Google Developers Console and obtain authorization credentials so your application can submit API requests.
After creating your project, make sure the YouTube Data API is one of the services that your application is registered to use:
a. Go to the Developers Console and select the project that you just registered.
b. Open the API Library in the Google Developers Console. If prompted, select a project or create a new one. In the list of APIs, make sure the status is ON for the YouTube Data API v3.
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.
see Getting started
I was getting the same error. The mistake I was making is not setting the API Key value while requesting. Please set the API Key attribute.
If you are using youtube data v3 api use following code snippet.
playlistItemsListByPlaylistIdRequest.setKey(YOUR_API_KEY_VALUE);
If you are using the Html request, then use following format :
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet%2CcontentDetails&maxResults=8&playlistId={PLAYLIST_ID}&key={YOUR_API_KEY}

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

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.

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/*

Resources