Google Custom Search is returning this 403 error from my iPhone 7.1 app. This is the response when run in the simulator:
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "accessNotConfigured",
"message": "Access Not Configured. Please use Google Developers Console to activate the API for your project."
}
],
"code": 403,
"message": "Access Not Configured. Please use Google Developers Console to activate the API for your project."
}
}
Is there a flaw in the steps below? I’d like to establish a working CSE setup process specific to iOS apps. The screenshots at each step will hopefully help and not confuse!
Create a Custom Search Engine (CSE) at https://www.google.com/cse/
From Setup -> Basics, get the Search engine ID.
Test the CSE at https://developers.google.com/apis-explorer/#p/customsearch/v1/search.cse.list
To get ourselves a key for ID and billing purposes, create a new project at https://console.developers.google.com/
Under APIs & auth -> APIs -> Enable "Custom Search API." No other APIs are enabled.
Under APIs & auth -> Credentials -> Create a new iOS key. Note: I also tried a browser key and the search result returned "Error 400: Invalid Value." I returned to the iOS key since I'm on iOS and the error seemed less severe.
Add to this key your bundle identifier from Xcode.
In Xcode make your GET request to the URL in step 3. Replace {YOUR_API_KEY} with the key from your credentials in steps 6-7.
NSData *response contains the error 403 shown above. Thanks for any thoughts on what's wrong!
"code": 403, "message": "The user does not have sufficient permissions for file {fileId}." To fix this error, instruct the user to contact the file's owner and request edit access. You can also check user access levels in the metadata retrieved by files.
This error is usually labeled as the http error 403. There may be several reasons why you are seeing this error message. It may be related to expired or cached browser cookies, a corrupted Google Drive download, and more.
It was missing the header field X-Ios-Bundle-Identifier.
NSString *bundleID = @"com.yourCompany.yourApp";
//...define request as above
[request setHTTPMethod:@"GET"];
[request setValue:bundleID forHTTPHeaderField:@"X-Ios-Bundle-Identifier"];
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