0

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"
Govaadiyo
  • 5,644
  • 9
  • 43
  • 72
  • Thanks for replying. Yes other features are working well. – Govaadiyo Jul 12 '18 at 13:39
  • Yes, its already there – Govaadiyo Jul 12 '18 at 13:40
  • Application restrictions to iOS Apps: means that allow app to using this API key through GooleMaps SDK only, but when you are using it on url will be denied because this is web api url(java script) – Moayad Al kouz Jul 12 '18 at 14:29
  • Ok understand it.. Thanks that means there is no any security related issue right ? I can use same key after upload app on app store ? – Govaadiyo Jul 13 '18 at 05:31
  • There is always security issue with unprotected keys. If somebody intercepts your request and steals your API key, they will be able to use it that might lead to billing issues for you. It is recommended always protect your keys with restrictions. You should use one API key for iOS app and another for web services. But web services will require intermediate server as explained in https://stackoverflow.com/a/46790201/5140781. – xomena Jul 14 '18 at 22:04

0 Answers0