2

I get the following error while using React Native Google Places autocomplete.

This IP, site or mobile application is not authorized to use this API key...

I'm using a Google Places API Web Service key, which restrictions on Android-App. This one is restricted with the package name com.xxx.xxx.debug and com.xxx.xxx.test. Another API key is restricted to com.xxx.xxx. I've added the proper SHA-1 key.

Anyone has a clue what I'am doing wrong or why it doesn't work? I've checked the docs of Google and tried out many different things, still I cannot get it to work with a restriction.

Jeffrey Rajan
  • 4,391
  • 4
  • 27
  • 37
Bertjuhh
  • 105
  • 1
  • 1
  • 9
  • Same issue here, was there any solution for this? - I have actually the same behaviour on both ios and android... I checked bundle ids and package names and sha-1. I think all is in place. – Fapi Jun 23 '22 at 09:30

1 Answers1

0

Add your React-Native android package id to the key you are using for Google Places API. You can find it in Project(Root Folder) => android => app => build.gradle => application id

Jeffrey Rajan
  • 4,391
  • 4
  • 27
  • 37
  • In the Google Console or the actual key in react native? Adding appId to key results in Key not valid error. – Bertjuhh Jul 11 '17 at 08:40
  • in your `Google Console` you have to add the package name and your `SHA-1` key – Jeffrey Rajan Jul 11 '17 at 09:05
  • I did that. The appId is com.xxx.xxx and we use a suffix for debug and test enviroments. So added 2 restrictions. com.xxx.xxx.debug and com.xxx.xxx.test with the right SHA-1 keys – Bertjuhh Jul 11 '17 at 09:11
  • Can you remove the restriction for the key and try once? and make sure you have enabled google place api – Jeffrey Rajan Jul 11 '17 at 13:20
  • But I need to put on restrictions, since otherwise the key can be abused. – Bertjuhh Jul 13 '17 at 08:01