hay,
im develop an app on ionic platform ,
im trying to get some information from google api to show on map
In ionic 4.7.1 on IOS I try to access Google Maps services and get the following error:
Google Maps JavaScript API error: RefererNotAllowedMapError
https://developers.google.com/maps/documentation/javascript/error-messages#referer-not-allowed-map-error
Your site URL to be authorized: ionic://my-domain/home/appointments-new/appointments-search-fields
The request with an ionic preffix instead of https preffix and causes error of CORS.
The RefererNotAllowedMapError means that the current URL loading the Maps JavaScript API has not been added to the list of allowed referrers, as per Error Messages documentation (https://developers.google.com/maps/documentation/javascript/error-messages).
As per the error message you have shared, you can add ionic://my-domain/home/appointments-new/appointments-search-fields to your list of website restrictions for the API key you're using. The steps on how to do this can be found here:
https://developers.google.com/maps/api-security-best-practices
https://youtu.be/2_HZObVbe-g
Related
I have been running google maps and google places API in my app for about a year now. I woke up today and was not able to use the map which was greyed out, or searches. In the console,
ERROR AUTO COMPLETE Error Domain=com.google.places.ErrorDomain Code=-4 "Operation failed due to an invalid (malformed or missing) API key. See the developer's guide (https://developers.google.com/places/ios-sdk/start) for information on creating and using an API key." UserInfo={NSLocalizedFailureReason=Operation failed due to an invalid (malformed or missing) API key. See the developer's guide (https://developers.google.com/places/ios-sdk/start) for information on creating and using an API key., NSUnderlyingError=0x283e81560 {Error Domain=com.google.places.api.server.ErrorDomain Code=-2 "REQUEST_DENIED" UserInfo={NSLocalizedFailureReason=This API project is not authorized to use this API. Please ensure this API is activated in the Google Developers Console: https://console.developers.google.com/apis/api/places_backend?project=_, NSLocalizedDescription=REQUEST_DENIED}}}
The thing is all of my API's are called in the right place and I have been able to use maps for a while. Why all of a sudden it stops working?
Recently Google announced the new version of Places SDK client and deprecated the previous one. I believe you should migrate to new version asap, because the deprecated version will stop working very soon.
The new Places SDK client requires that you enable Places API web service in your Cloud project. The error message This API project is not authorized to use this API. Please ensure this API is activated in the Google Developers Console: https://console.developers.google.com/apis/api/places_backend?project=_, refers to the Places API web service.
Double check if the Places API web service is enabled, API key created and billing account configured properly.
The official documentation has the following statement
To use the Places SDK for iOS, you must:
Include an API key with all API requests.
Enable billing on each of your projects.
Enable the Places API service for each of your projects
For further details have a look at migration guide:
https://developers.google.com/places/ios-sdk/client-migration
I hope this helps!
I followed all the steps mentioned in the guide:
Installed iOS SDKs for GoogleMaps, GooglePlaces, GooglePlacePicker.
Enabled Places API in google console
Created an API key and set them in AppDelegate.(I waited for few hours)
But still I get error:
The Places API for iOS is not enabled. See the developer's guide (https://developers.google.com/places/ios-sdk/start) for how to enable the Google Places API for iOS
I’m trying to use Google Directions API. I have the SDK all set up. I have enabled Google Maps SDK for iOS under the Services in the developer console. Below is the URL I've built to get the directions.
There are two types of keys in the developer console.
First I tried with the Key for iOS apps.
https://maps.googleapis.com/maps/api/directions/json?origin=-37.814107,144.96328&destination=-31.953004,115.857469&key=<Key for iOS apps>
But I got the error This IP, site or mobile application is not authorized to use this API key.
When I searched for a solution to this error I saw in a few StackOverflow answers (1, 2) that iOS keys are not supported. In the answers they're talking about the Google Places API but I thought it might be the same case with Directions because the error was the same.
So I replaces the Key for iOS apps with Key for browser apps and ran it again but I got a new error This API project is not authorized to use this API. Please ensure that this API is activated in the APIs Console.
My question is are there any other APIs I have to activate in the Services to get this working? These are the other map related Google APIs in the list.
The API "Google Maps SDK for iOS" - it is only for integrating the "Google Maps SDK"...
If you want to “use” Directions.. you have to “activate” in the Google console: "Directions API” , too developers.google.com/maps/documentation/directions
Happy coding!
Are you using
https://developers.google.com/maps/documentation/ios/ also there is a nice documentation there.
Yes you need to activate the IOS Maps SDK in the google api center when you log in
I am having issues with my API key for the iOS Google Maps SDK.
Currently I have multiple applications one using the Javascript API, and Android one and now and iOS app. The Web and Android app works fine but I always receive and invalid api key. Bundles are definitely matching and the iOS SDK is enabled under services.
I created an api key on my personal gmail account and linked it to the bundle and it worked fine. Removed it and create the api key back on the console for the other api's and it fails. Has anyone come across this problem before?
I'm using oAuth2, and I have a project in my google API console with an iOS client and a Web client registered.
I'd like to auth in from my iOS app, and have my web backend retrieve an access token so it can do the heavy processing work with the Google api.
I've tried following these instructions which are for android: https://developers.google.com/accounts/docs/CrossClientAuth
But I keep getting an invalid scope when I assign the scope as:
oauth2:server:client_id:MY.WEB.CLIENT.ID:api_scope:http://www.google.com/m8/feeds/ https://mail.google.com/ https://www.googleapis.com/auth/plus.login
Anyone successfully implement a similar set up for iOS? If so please explain or share documentation? What libraries or SDKs did you use to get the code from google on the iOS app that the web backend could use to generate a proper access token of it's own?
As of June 18th, the google iOS SDK 1.7.0 supports one-time authorization code which is consistent with the Android feature: https://developers.google.com/+/release-notes/