I am trying to integrate google maps in my iOS App. I created and tried the iOS key, Server key and browser key as well. I regenerated the keys, but still gets the status as "ACCESS DENIED". I have seen many answers here, but none of the solutions work for me. I get the following response
This API project is not authorized to use this API. Please ensure that this API is activated in the APIs Console
and sometimes this
"error_message" : "This IP, site or mobile application is not authorized to use this API key. Request received from IP address xxx.xxx.xxx.xxx, with empty referer"
And I tried to use the regenerated key, and i get the following result.
"error_message" : "The provided API key is expired."
The solution may be simple, but I'm really stuck. Any help is appreciated
the log or error is clear.
for use google_maps you must :
• register your app bundle in Google Developer
• get api key ( if you had get it before update it)
• call the google initialize in AppDelegate
[GMSServices provideAPIKey:GOOGLE_MAP_SERVICE];
Related
I am trying to authenticate to Google OAuth 2 via a native Mac app. I set up my app in the Google Developer Console as a Desktop application, and there is nowhere to specify a redirect_uri. As I understand it, those are only available to web applications.
But in composing my request in Swift using ASWebAuthenticationSession, my resulting authentication URL is like this (line breaks added for legibility):
https://accounts.google.com/o/oauth2/v2/auth?
client_id=******.apps.googleusercontent.com&
response_type=code&
redirect_uri=pro.cova%3A%2F&
scope=profile%2520email%2520https%3A%2F%2Fmail.google.com%2F&flowName=GeneralOAuthFlow
My app's custom URL type is pro.cova:/.
I'm getting this error from Google:
Error 400: redirect_uri_mismatch
What mismatch could be happening if there isn't one specified in the Google Developer Console?
It turns out that when building a native Mac app, you have to create "iOS" API credentials in the Google Developer Console. When setting it up, you have to specify your bundle ID like this: pro.cova
When you set the redirect_uri in your ASWebAuthenticationSession request, it must have a :/ at the end like this: redirect_uri=pro.cova:/
But the callbackURLScheme in your ASWebAuthenticationSession is without the :/ so it's just pro.cova.
I wish Google's API docs said "iOS or Mac" for the API credential options.
I have just simple question. I'm using goole map and direction API. So I need to create API key thats fine, I have done it.
But When I edit my API key and select Application restrictions to iOS Apps and save it.
I'm using this key in my app then I'm getting below error message.
This IP, site or mobile application is not authorized to use this API key. Request received from IP address XXX.XXX.XX.XXX, with empty referer
But If I remove the application bundle id from iOS Apps then API key is working
Also I'm referring this question This IP, site or mobile application is not authorized to use this API key
But some confusion are, Can we keep it as blank? There is any security related issue? do I need to do any changes when I'm going to upload app on app store ?
NOTE: I'm using API key in all the places in the coding. like
GMSServices.provideAPIKey(googleAPIKey)
and
let urlString = "https://maps.googleapis.com/maps/api/directions/json?origin=\(myCoordinateStr)&destination=\(destinationCoorinateStr)&key=\(googleAPIKey)&sensor=true"
We are using the google API library (objective-c) to try and access YouTube data. I have created an iOS key from Google Console, limited it to a specific bundle id and enabled it. Requests are failing with the error below. I know that it is a known issue while using bundle identifier to generate the key, but want to confirm if this issue still persists or it is resolved now and expected to work?
I tried experimenting from my side and came to the conclusion that it is still an issue. But just want to confirm if anyone tried recently and succeeded or have any workaround for this issue.Just want to ensure an extra security measure if it is resolved by now.
Error Domain=com.google.GTLJSONRPCErrorDomain Code=403 "The operation
couldn’t be completed. (Access Not Configured. Please use Google
Developers Console to activate the API for your project.)"
UserInfo=0xa3aa0e0 {error=Access Not Configured. Please use Google
Developers Console to activate the API for your project.,
GTLStructuredError=GTLErrorObject 0x8a74630: {message:"Access Not
Configured. Please use Google Developers Console to activate the API
for your project." code:403 data:1},
NSLocalizedFailureReason=(Access Not Configured. Please use Google
Developers Console to activate the API for your project.)}
Issues previously discussed:
Access not configured YouTube API
Access Not Configured Error, Even Though Access is Configured
I am trying to show nearby places with selected types
types - Bar, Cafe, ATM etc
I have created project on developer console.
enable API (google places api, google map sdk, direction api)
I have created iOS api keys but Api key not working. I got this error message
This IP, site or mobile application is not authorized to use this API
key. Request received from IP address 114.143.244.10, with empty
referer
When I tried browser api key I got this error
This API project is not authorized to use this API.
Please ensure that this API is activated in the APIs Console: Learn
more: https://code.google.com/apis/console
I am using this url
NSString *url = [NSString stringWithFormat:#"https://maps.googleapis.com/maps/api/place/search/json?location=%f,%f&radius=%#&types=%#&sensor=true&key=%#",
currentCentre.latitude,
currentCentre.longitude,
[NSString stringWithFormat:#"%i", currenDist],
googleType,
kGOOGLE_API_KEY
];
I didn't get what is the problem.
Enable to this api Google Places API Web Service & Google Places API for iOS in the APIs Console
Refer to this document....
Google Places API Web Service
https://developers.google.com/places/webservice/search
Please Check Your All API are Enable On The Google Developer Console
Step 1 Go to Developer Console
Step 2 API Manager ==> API Library ==> Google Maps APIs ==> More
Step 3 And Enable ==> Google Places API Web Service
(AutoComplete and Seaching)
Step 4 Done Enjoy (^_^) ALl Is Done !!!!
NOTE:- Make Sure Your API KEY is Proper and Created Okay ....
I think i know your problem now, it possible that you missed a step..
the steps are suppose to be:
1) Go to Developer Console https://code.google.com/apis/console/
2) In the Credentials, under Public API Access , Create New key
3) Select the server key from the option.
4) Enter your IP Address on the field and if you have more ip addresses, you can just add on every single line.NOTE: Enter the IP Address only when you want to use it for your testing purpose. Else leave the IP Address section blank.
5) Once you are done, click create and your new Server Key will be generated and you can then add that server key to your URL.
use it like:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=[lat],[lon]&radius=[radius]&key=kGOOGLE_API_KEY&sensor=true
or from the tutorial that you are using..
https://maps.googleapis.com/maps/api/place/search/json?location=[lat],[lon]&radius=[radius]&types=[type]&key=kGOOGLE_API_KEY&sensor=true
as you can see &sensor=true is the last parameter..(don't trust anything on the internet).. hahaha..
everything must have been working if you have followed, carefully.. i suggest do it from the top.. hahaha.. Lols.. you'll know and learn what's missing/forgotten, and that'll help you be a better person.. Lols.. Good luck sir.. :)
Try to use this library https://github.com/FuerteInternational/FTGooglePlacesAPI with your key and let me know.
I'm trying to call the Google Places API to return a list of restaurants near me. When I call this from a browser it works fine. However, when I call this from inside an iOS App I built using Ionic Framework, it fails with a data NULL, status 0 error.
I researched quite a bit, figured out this was a CORS issue. I looked up Google documentation on how to issue GET requests for iOS App. I used my app's bundle id to create a key and client ID for my app. Using the steps here https://developers.google.com/accounts/docs/OAuth2InstalledApp#overview, I obtained an access_token, which I used as a query parameter just like the docs mentioned. Nothing works. What is going wrong?
URL that works on browser: https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=MyServerApplicationsKey&location=33.85463,-84.35870&rankby=distance&types=restaurant
URL that fails from IOS App: https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=MyiOSApplicationsKey&location=33.85463,-84.35870&rankby=distance&types=restaurant&access_token=MyToken
#plexer
I use the server key to call the URL from the browser. That works, as mentioned. From the App if I use this key, I get the following error:
{"data":null,"status":0,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"url":"sameUrlThatWorksOnBrowser","headers":{"Accept":"application/json, text/plain, /"}},"statusText":""}
The Google Places API uses a Public API Access key, rather than oAuth. The good news is that these are a lot simpler to get started with.
Follow the instructions under the Authentication section on this page to create a new Public API access key, then include that key in the &key parameter for your application.
After clicking the "Create new Key" button, select "Server key". That's a bit weird, since you are calling the API from iOS, but it will work.