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











up vote
71
down vote

favorite
18












I am using https://maps.googleapis.com/maps/api/geocode/json? link with server key and user ip to find the latitude and longitude of any address , when i m trying i am finding the error as



I have a server access key from google and I have put my server's IP address in the their white list.



The URL that I am trying to access via PHP CURL is:



https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=true&key=XXXXXXXXXXXX



The result that I am getting:



Array ([error_message] => This IP, site or mobile application is not authorized to use this API key. [results] => Array ( ) [status] => REQUEST_DENIED)


Is there anything that I need to configure.
The geocoding api is also switched on.










share|improve this question
























  • you have to get a authorised key from google , and put it into the api
    – Dimag Kharab
    Feb 21 '14 at 11:32










  • There is already an API key available
    – sanket
    Feb 21 '14 at 11:45










  • Check the answer by Mike it worked for me
    – Sheraz Ahmad Khilji
    Sep 3 '14 at 5:33










  • Accept mike20132013's answer! It works!
    – aveschini
    Jul 1 '15 at 9:37















up vote
71
down vote

favorite
18












I am using https://maps.googleapis.com/maps/api/geocode/json? link with server key and user ip to find the latitude and longitude of any address , when i m trying i am finding the error as



I have a server access key from google and I have put my server's IP address in the their white list.



The URL that I am trying to access via PHP CURL is:



https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=true&key=XXXXXXXXXXXX



The result that I am getting:



Array ([error_message] => This IP, site or mobile application is not authorized to use this API key. [results] => Array ( ) [status] => REQUEST_DENIED)


Is there anything that I need to configure.
The geocoding api is also switched on.










share|improve this question
























  • you have to get a authorised key from google , and put it into the api
    – Dimag Kharab
    Feb 21 '14 at 11:32










  • There is already an API key available
    – sanket
    Feb 21 '14 at 11:45










  • Check the answer by Mike it worked for me
    – Sheraz Ahmad Khilji
    Sep 3 '14 at 5:33










  • Accept mike20132013's answer! It works!
    – aveschini
    Jul 1 '15 at 9:37













up vote
71
down vote

favorite
18









up vote
71
down vote

favorite
18






18





I am using https://maps.googleapis.com/maps/api/geocode/json? link with server key and user ip to find the latitude and longitude of any address , when i m trying i am finding the error as



I have a server access key from google and I have put my server's IP address in the their white list.



The URL that I am trying to access via PHP CURL is:



https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=true&key=XXXXXXXXXXXX



The result that I am getting:



Array ([error_message] => This IP, site or mobile application is not authorized to use this API key. [results] => Array ( ) [status] => REQUEST_DENIED)


Is there anything that I need to configure.
The geocoding api is also switched on.










share|improve this question















I am using https://maps.googleapis.com/maps/api/geocode/json? link with server key and user ip to find the latitude and longitude of any address , when i m trying i am finding the error as



I have a server access key from google and I have put my server's IP address in the their white list.



The URL that I am trying to access via PHP CURL is:



https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=true&key=XXXXXXXXXXXX



The result that I am getting:



Array ([error_message] => This IP, site or mobile application is not authorized to use this API key. [results] => Array ( ) [status] => REQUEST_DENIED)


Is there anything that I need to configure.
The geocoding api is also switched on.







google-api google-places-api






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 2:06









jww

52k37213479




52k37213479










asked Feb 21 '14 at 11:30









user3336944

364133




364133












  • you have to get a authorised key from google , and put it into the api
    – Dimag Kharab
    Feb 21 '14 at 11:32










  • There is already an API key available
    – sanket
    Feb 21 '14 at 11:45










  • Check the answer by Mike it worked for me
    – Sheraz Ahmad Khilji
    Sep 3 '14 at 5:33










  • Accept mike20132013's answer! It works!
    – aveschini
    Jul 1 '15 at 9:37


















  • you have to get a authorised key from google , and put it into the api
    – Dimag Kharab
    Feb 21 '14 at 11:32










  • There is already an API key available
    – sanket
    Feb 21 '14 at 11:45










  • Check the answer by Mike it worked for me
    – Sheraz Ahmad Khilji
    Sep 3 '14 at 5:33










  • Accept mike20132013's answer! It works!
    – aveschini
    Jul 1 '15 at 9:37
















you have to get a authorised key from google , and put it into the api
– Dimag Kharab
Feb 21 '14 at 11:32




you have to get a authorised key from google , and put it into the api
– Dimag Kharab
Feb 21 '14 at 11:32












There is already an API key available
– sanket
Feb 21 '14 at 11:45




There is already an API key available
– sanket
Feb 21 '14 at 11:45












Check the answer by Mike it worked for me
– Sheraz Ahmad Khilji
Sep 3 '14 at 5:33




Check the answer by Mike it worked for me
– Sheraz Ahmad Khilji
Sep 3 '14 at 5:33












Accept mike20132013's answer! It works!
– aveschini
Jul 1 '15 at 9:37




Accept mike20132013's answer! It works!
– aveschini
Jul 1 '15 at 9:37












9 Answers
9






active

oldest

votes

















up vote
130
down vote













I had the same issue and I found this.



On the url, it requires the server key in the end and not the api key for the app.



So Basically, you just add the server key in the end of the URL like this:



https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=yourlatitude,yourlongitude&radius=5000&sensor=true&key=SERVERKEY



Now, to obtain the server key, just follow these steps:



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.



Last thing is that, instead of putting the sensor=true in the middle of the URL, you can add it in the end like this:



https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=yourlatitude,yourlongitude&radius=5000&key=SERVERKEY&sensor=true



This will definitely solve the issue and just remember to use the server key for Places API.



Hope this answer will help you and other viewers. Good Luck .. :)






share|improve this answer



















  • 8




    Very Important 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.
    – Sheraz Ahmad Khilji
    Sep 3 '14 at 5:32






  • 6




    That's correct.. only specify the IP Address/Addresses for testing purpose. Else, leave it blank. Because you are restricting the app or the api key to work only on the specific devices/app.
    – mike20132013
    Sep 3 '14 at 13:37






  • 6




    +1 for leaving the IP Address field blank.
    – Carsten Winsnes
    Oct 16 '14 at 22:11






  • 1




    @johnshumon Yes i guess.. haven't updated the answer for ages. Might be some new API changes.
    – mike20132013
    Nov 30 '15 at 4:10






  • 1




    May want to also make sure Google Places API Web Service is an enabled API as well
    – Justin Wilson
    Apr 21 '16 at 3:16


















up vote
13
down vote













In addition to the API key that is assigned to you, Google also verifies the source of the incoming request by looking at either the REFERRER or the IP address. To run an example in curl, create a new Server Key in Google APIs console. While creating it, you must provide the IP address of the server. In this case, it will be your local IP address. Once you have created a Server Key and whitelisted your IP address, you should be able to use the new API key in curl.



My guess is you probably created your API key as a Browser Key which does not require you to whitelist your IP address, but instead uses the REFERRER HTTP header tag for validation. curl doesn't send this tag by default, so Google was failing to validate your request.






share|improve this answer





















  • 1+ Will need to create server API key for using Geocode service of Google. Also need to enable Google map geocodding service from Google's API console.. Thanks!!
    – Sumit Munot
    Apr 3 '14 at 20:49


















up vote
5
down vote













The Google Places API does not currently support Android or iOS keys generated from the Google APIs Console. Only Server and Browser keys are currently supported.






share|improve this answer




























    up vote
    4
    down vote














    1. Choose key

    2. API Restriction tab

    3. Choose API key

    4. Save

    5. Choose Application Restriction -> None

    6. Save


    enter image description here



    enter image description here



    enter image description here



    enter image description here






    share|improve this answer





















    • i had few services listed in api restrictions but not geocoding
      – Muhammad Umer
      Oct 12 at 1:03


















    up vote
    2
    down vote













    You create an key with out referer
    dont enter the referer address






    share|improve this answer





















    • could you please elaborate
      – Sagar Devanga
      Jun 13 '15 at 6:59






    • 2




      While Creating the key you have as place to add Referer Address please Check you had Added something there. if Added Clear it
      – DeadlyDroid
      Jun 14 '15 at 12:06


















    up vote
    1
    down vote













    Google Place API requires the referer HTTP header to be included when making the API call.



    Include HTTP header "Referer:yourdomain.com" and this should fix the response issues.






    share|improve this answer



















    • 1




      While this may answer the question it’s always a good idea to put some text in your answer to explain what you're doing. Read how to write a good answer. Also, you should include some code.
      – Jørgen R
      Mar 4 '15 at 7:42










    • Could you please provide a snippet
      – Sagar Devanga
      Jun 13 '15 at 7:04










    • Here's what I did, and it worked perfectly: var options = { url: url, headers:{ Referer:'xxx.herokuapp.com' } }; request.get(options, function(...
      – Florida G.
      Feb 21 '17 at 20:06




















    up vote
    1
    down vote













    Also the corresponding API should be enabled for the given project



    https://console.developers.google.com/apis/library?project=projectnamehere






    share|improve this answer




























      up vote
      -1
      down vote













      I faced the problem because i did not enable the APL key in Google console.






      share|improve this answer




























        up vote
        -1
        down vote













          url = https://maps.googleapis.com/maps/api/directions/json?origin=19.0176147,72.8561644&destination=28.65381,77.22897&mode=driving&key=AIzaSyATaUNPUjc5rs0lVp2Z_spnJle-AvhKLHY


        add only in AppDelegate like



                    GMSServices.provideAPIKey("AIzaSyATaUNPUjc5rs0lVp2Z_spnJle-AvhKLHY")


        and remove the key in this url.



        now url is



        https://maps.googleapis.com/maps/api/directions/json?origin=19.0176147,72.8561644&destination=28.65381,77.22897&mode=driving





        share|improve this answer























          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f21933247%2fthis-ip-site-or-mobile-application-is-not-authorized-to-use-this-api-key%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          9 Answers
          9






          active

          oldest

          votes








          9 Answers
          9






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          130
          down vote













          I had the same issue and I found this.



          On the url, it requires the server key in the end and not the api key for the app.



          So Basically, you just add the server key in the end of the URL like this:



          https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=yourlatitude,yourlongitude&radius=5000&sensor=true&key=SERVERKEY



          Now, to obtain the server key, just follow these steps:



          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.



          Last thing is that, instead of putting the sensor=true in the middle of the URL, you can add it in the end like this:



          https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=yourlatitude,yourlongitude&radius=5000&key=SERVERKEY&sensor=true



          This will definitely solve the issue and just remember to use the server key for Places API.



          Hope this answer will help you and other viewers. Good Luck .. :)






          share|improve this answer



















          • 8




            Very Important 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.
            – Sheraz Ahmad Khilji
            Sep 3 '14 at 5:32






          • 6




            That's correct.. only specify the IP Address/Addresses for testing purpose. Else, leave it blank. Because you are restricting the app or the api key to work only on the specific devices/app.
            – mike20132013
            Sep 3 '14 at 13:37






          • 6




            +1 for leaving the IP Address field blank.
            – Carsten Winsnes
            Oct 16 '14 at 22:11






          • 1




            @johnshumon Yes i guess.. haven't updated the answer for ages. Might be some new API changes.
            – mike20132013
            Nov 30 '15 at 4:10






          • 1




            May want to also make sure Google Places API Web Service is an enabled API as well
            – Justin Wilson
            Apr 21 '16 at 3:16















          up vote
          130
          down vote













          I had the same issue and I found this.



          On the url, it requires the server key in the end and not the api key for the app.



          So Basically, you just add the server key in the end of the URL like this:



          https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=yourlatitude,yourlongitude&radius=5000&sensor=true&key=SERVERKEY



          Now, to obtain the server key, just follow these steps:



          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.



          Last thing is that, instead of putting the sensor=true in the middle of the URL, you can add it in the end like this:



          https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=yourlatitude,yourlongitude&radius=5000&key=SERVERKEY&sensor=true



          This will definitely solve the issue and just remember to use the server key for Places API.



          Hope this answer will help you and other viewers. Good Luck .. :)






          share|improve this answer



















          • 8




            Very Important 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.
            – Sheraz Ahmad Khilji
            Sep 3 '14 at 5:32






          • 6




            That's correct.. only specify the IP Address/Addresses for testing purpose. Else, leave it blank. Because you are restricting the app or the api key to work only on the specific devices/app.
            – mike20132013
            Sep 3 '14 at 13:37






          • 6




            +1 for leaving the IP Address field blank.
            – Carsten Winsnes
            Oct 16 '14 at 22:11






          • 1




            @johnshumon Yes i guess.. haven't updated the answer for ages. Might be some new API changes.
            – mike20132013
            Nov 30 '15 at 4:10






          • 1




            May want to also make sure Google Places API Web Service is an enabled API as well
            – Justin Wilson
            Apr 21 '16 at 3:16













          up vote
          130
          down vote










          up vote
          130
          down vote









          I had the same issue and I found this.



          On the url, it requires the server key in the end and not the api key for the app.



          So Basically, you just add the server key in the end of the URL like this:



          https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=yourlatitude,yourlongitude&radius=5000&sensor=true&key=SERVERKEY



          Now, to obtain the server key, just follow these steps:



          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.



          Last thing is that, instead of putting the sensor=true in the middle of the URL, you can add it in the end like this:



          https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=yourlatitude,yourlongitude&radius=5000&key=SERVERKEY&sensor=true



          This will definitely solve the issue and just remember to use the server key for Places API.



          Hope this answer will help you and other viewers. Good Luck .. :)






          share|improve this answer














          I had the same issue and I found this.



          On the url, it requires the server key in the end and not the api key for the app.



          So Basically, you just add the server key in the end of the URL like this:



          https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=yourlatitude,yourlongitude&radius=5000&sensor=true&key=SERVERKEY



          Now, to obtain the server key, just follow these steps:



          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.



          Last thing is that, instead of putting the sensor=true in the middle of the URL, you can add it in the end like this:



          https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=yourlatitude,yourlongitude&radius=5000&key=SERVERKEY&sensor=true



          This will definitely solve the issue and just remember to use the server key for Places API.



          Hope this answer will help you and other viewers. Good Luck .. :)







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 8 '15 at 23:20

























          answered Jun 16 '14 at 1:30









          mike20132013

          4,50722437




          4,50722437








          • 8




            Very Important 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.
            – Sheraz Ahmad Khilji
            Sep 3 '14 at 5:32






          • 6




            That's correct.. only specify the IP Address/Addresses for testing purpose. Else, leave it blank. Because you are restricting the app or the api key to work only on the specific devices/app.
            – mike20132013
            Sep 3 '14 at 13:37






          • 6




            +1 for leaving the IP Address field blank.
            – Carsten Winsnes
            Oct 16 '14 at 22:11






          • 1




            @johnshumon Yes i guess.. haven't updated the answer for ages. Might be some new API changes.
            – mike20132013
            Nov 30 '15 at 4:10






          • 1




            May want to also make sure Google Places API Web Service is an enabled API as well
            – Justin Wilson
            Apr 21 '16 at 3:16














          • 8




            Very Important 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.
            – Sheraz Ahmad Khilji
            Sep 3 '14 at 5:32






          • 6




            That's correct.. only specify the IP Address/Addresses for testing purpose. Else, leave it blank. Because you are restricting the app or the api key to work only on the specific devices/app.
            – mike20132013
            Sep 3 '14 at 13:37






          • 6




            +1 for leaving the IP Address field blank.
            – Carsten Winsnes
            Oct 16 '14 at 22:11






          • 1




            @johnshumon Yes i guess.. haven't updated the answer for ages. Might be some new API changes.
            – mike20132013
            Nov 30 '15 at 4:10






          • 1




            May want to also make sure Google Places API Web Service is an enabled API as well
            – Justin Wilson
            Apr 21 '16 at 3:16








          8




          8




          Very Important 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.
          – Sheraz Ahmad Khilji
          Sep 3 '14 at 5:32




          Very Important 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.
          – Sheraz Ahmad Khilji
          Sep 3 '14 at 5:32




          6




          6




          That's correct.. only specify the IP Address/Addresses for testing purpose. Else, leave it blank. Because you are restricting the app or the api key to work only on the specific devices/app.
          – mike20132013
          Sep 3 '14 at 13:37




          That's correct.. only specify the IP Address/Addresses for testing purpose. Else, leave it blank. Because you are restricting the app or the api key to work only on the specific devices/app.
          – mike20132013
          Sep 3 '14 at 13:37




          6




          6




          +1 for leaving the IP Address field blank.
          – Carsten Winsnes
          Oct 16 '14 at 22:11




          +1 for leaving the IP Address field blank.
          – Carsten Winsnes
          Oct 16 '14 at 22:11




          1




          1




          @johnshumon Yes i guess.. haven't updated the answer for ages. Might be some new API changes.
          – mike20132013
          Nov 30 '15 at 4:10




          @johnshumon Yes i guess.. haven't updated the answer for ages. Might be some new API changes.
          – mike20132013
          Nov 30 '15 at 4:10




          1




          1




          May want to also make sure Google Places API Web Service is an enabled API as well
          – Justin Wilson
          Apr 21 '16 at 3:16




          May want to also make sure Google Places API Web Service is an enabled API as well
          – Justin Wilson
          Apr 21 '16 at 3:16












          up vote
          13
          down vote













          In addition to the API key that is assigned to you, Google also verifies the source of the incoming request by looking at either the REFERRER or the IP address. To run an example in curl, create a new Server Key in Google APIs console. While creating it, you must provide the IP address of the server. In this case, it will be your local IP address. Once you have created a Server Key and whitelisted your IP address, you should be able to use the new API key in curl.



          My guess is you probably created your API key as a Browser Key which does not require you to whitelist your IP address, but instead uses the REFERRER HTTP header tag for validation. curl doesn't send this tag by default, so Google was failing to validate your request.






          share|improve this answer





















          • 1+ Will need to create server API key for using Geocode service of Google. Also need to enable Google map geocodding service from Google's API console.. Thanks!!
            – Sumit Munot
            Apr 3 '14 at 20:49















          up vote
          13
          down vote













          In addition to the API key that is assigned to you, Google also verifies the source of the incoming request by looking at either the REFERRER or the IP address. To run an example in curl, create a new Server Key in Google APIs console. While creating it, you must provide the IP address of the server. In this case, it will be your local IP address. Once you have created a Server Key and whitelisted your IP address, you should be able to use the new API key in curl.



          My guess is you probably created your API key as a Browser Key which does not require you to whitelist your IP address, but instead uses the REFERRER HTTP header tag for validation. curl doesn't send this tag by default, so Google was failing to validate your request.






          share|improve this answer





















          • 1+ Will need to create server API key for using Geocode service of Google. Also need to enable Google map geocodding service from Google's API console.. Thanks!!
            – Sumit Munot
            Apr 3 '14 at 20:49













          up vote
          13
          down vote










          up vote
          13
          down vote









          In addition to the API key that is assigned to you, Google also verifies the source of the incoming request by looking at either the REFERRER or the IP address. To run an example in curl, create a new Server Key in Google APIs console. While creating it, you must provide the IP address of the server. In this case, it will be your local IP address. Once you have created a Server Key and whitelisted your IP address, you should be able to use the new API key in curl.



          My guess is you probably created your API key as a Browser Key which does not require you to whitelist your IP address, but instead uses the REFERRER HTTP header tag for validation. curl doesn't send this tag by default, so Google was failing to validate your request.






          share|improve this answer












          In addition to the API key that is assigned to you, Google also verifies the source of the incoming request by looking at either the REFERRER or the IP address. To run an example in curl, create a new Server Key in Google APIs console. While creating it, you must provide the IP address of the server. In this case, it will be your local IP address. Once you have created a Server Key and whitelisted your IP address, you should be able to use the new API key in curl.



          My guess is you probably created your API key as a Browser Key which does not require you to whitelist your IP address, but instead uses the REFERRER HTTP header tag for validation. curl doesn't send this tag by default, so Google was failing to validate your request.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 11 '14 at 21:18









          Michael Venable

          4,33431718




          4,33431718












          • 1+ Will need to create server API key for using Geocode service of Google. Also need to enable Google map geocodding service from Google's API console.. Thanks!!
            – Sumit Munot
            Apr 3 '14 at 20:49


















          • 1+ Will need to create server API key for using Geocode service of Google. Also need to enable Google map geocodding service from Google's API console.. Thanks!!
            – Sumit Munot
            Apr 3 '14 at 20:49
















          1+ Will need to create server API key for using Geocode service of Google. Also need to enable Google map geocodding service from Google's API console.. Thanks!!
          – Sumit Munot
          Apr 3 '14 at 20:49




          1+ Will need to create server API key for using Geocode service of Google. Also need to enable Google map geocodding service from Google's API console.. Thanks!!
          – Sumit Munot
          Apr 3 '14 at 20:49










          up vote
          5
          down vote













          The Google Places API does not currently support Android or iOS keys generated from the Google APIs Console. Only Server and Browser keys are currently supported.






          share|improve this answer

























            up vote
            5
            down vote













            The Google Places API does not currently support Android or iOS keys generated from the Google APIs Console. Only Server and Browser keys are currently supported.






            share|improve this answer























              up vote
              5
              down vote










              up vote
              5
              down vote









              The Google Places API does not currently support Android or iOS keys generated from the Google APIs Console. Only Server and Browser keys are currently supported.






              share|improve this answer












              The Google Places API does not currently support Android or iOS keys generated from the Google APIs Console. Only Server and Browser keys are currently supported.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Jun 24 '16 at 9:10









              Nazrul Islam

              414411




              414411






















                  up vote
                  4
                  down vote














                  1. Choose key

                  2. API Restriction tab

                  3. Choose API key

                  4. Save

                  5. Choose Application Restriction -> None

                  6. Save


                  enter image description here



                  enter image description here



                  enter image description here



                  enter image description here






                  share|improve this answer





















                  • i had few services listed in api restrictions but not geocoding
                    – Muhammad Umer
                    Oct 12 at 1:03















                  up vote
                  4
                  down vote














                  1. Choose key

                  2. API Restriction tab

                  3. Choose API key

                  4. Save

                  5. Choose Application Restriction -> None

                  6. Save


                  enter image description here



                  enter image description here



                  enter image description here



                  enter image description here






                  share|improve this answer





















                  • i had few services listed in api restrictions but not geocoding
                    – Muhammad Umer
                    Oct 12 at 1:03













                  up vote
                  4
                  down vote










                  up vote
                  4
                  down vote










                  1. Choose key

                  2. API Restriction tab

                  3. Choose API key

                  4. Save

                  5. Choose Application Restriction -> None

                  6. Save


                  enter image description here



                  enter image description here



                  enter image description here



                  enter image description here






                  share|improve this answer













                  1. Choose key

                  2. API Restriction tab

                  3. Choose API key

                  4. Save

                  5. Choose Application Restriction -> None

                  6. Save


                  enter image description here



                  enter image description here



                  enter image description here



                  enter image description here







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Sep 21 at 8:03









                  Tuan Nguyen

                  327113




                  327113












                  • i had few services listed in api restrictions but not geocoding
                    – Muhammad Umer
                    Oct 12 at 1:03


















                  • i had few services listed in api restrictions but not geocoding
                    – Muhammad Umer
                    Oct 12 at 1:03
















                  i had few services listed in api restrictions but not geocoding
                  – Muhammad Umer
                  Oct 12 at 1:03




                  i had few services listed in api restrictions but not geocoding
                  – Muhammad Umer
                  Oct 12 at 1:03










                  up vote
                  2
                  down vote













                  You create an key with out referer
                  dont enter the referer address






                  share|improve this answer





















                  • could you please elaborate
                    – Sagar Devanga
                    Jun 13 '15 at 6:59






                  • 2




                    While Creating the key you have as place to add Referer Address please Check you had Added something there. if Added Clear it
                    – DeadlyDroid
                    Jun 14 '15 at 12:06















                  up vote
                  2
                  down vote













                  You create an key with out referer
                  dont enter the referer address






                  share|improve this answer





















                  • could you please elaborate
                    – Sagar Devanga
                    Jun 13 '15 at 6:59






                  • 2




                    While Creating the key you have as place to add Referer Address please Check you had Added something there. if Added Clear it
                    – DeadlyDroid
                    Jun 14 '15 at 12:06













                  up vote
                  2
                  down vote










                  up vote
                  2
                  down vote









                  You create an key with out referer
                  dont enter the referer address






                  share|improve this answer












                  You create an key with out referer
                  dont enter the referer address







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered May 26 '14 at 13:23









                  DeadlyDroid

                  895




                  895












                  • could you please elaborate
                    – Sagar Devanga
                    Jun 13 '15 at 6:59






                  • 2




                    While Creating the key you have as place to add Referer Address please Check you had Added something there. if Added Clear it
                    – DeadlyDroid
                    Jun 14 '15 at 12:06


















                  • could you please elaborate
                    – Sagar Devanga
                    Jun 13 '15 at 6:59






                  • 2




                    While Creating the key you have as place to add Referer Address please Check you had Added something there. if Added Clear it
                    – DeadlyDroid
                    Jun 14 '15 at 12:06
















                  could you please elaborate
                  – Sagar Devanga
                  Jun 13 '15 at 6:59




                  could you please elaborate
                  – Sagar Devanga
                  Jun 13 '15 at 6:59




                  2




                  2




                  While Creating the key you have as place to add Referer Address please Check you had Added something there. if Added Clear it
                  – DeadlyDroid
                  Jun 14 '15 at 12:06




                  While Creating the key you have as place to add Referer Address please Check you had Added something there. if Added Clear it
                  – DeadlyDroid
                  Jun 14 '15 at 12:06










                  up vote
                  1
                  down vote













                  Google Place API requires the referer HTTP header to be included when making the API call.



                  Include HTTP header "Referer:yourdomain.com" and this should fix the response issues.






                  share|improve this answer



















                  • 1




                    While this may answer the question it’s always a good idea to put some text in your answer to explain what you're doing. Read how to write a good answer. Also, you should include some code.
                    – Jørgen R
                    Mar 4 '15 at 7:42










                  • Could you please provide a snippet
                    – Sagar Devanga
                    Jun 13 '15 at 7:04










                  • Here's what I did, and it worked perfectly: var options = { url: url, headers:{ Referer:'xxx.herokuapp.com' } }; request.get(options, function(...
                    – Florida G.
                    Feb 21 '17 at 20:06

















                  up vote
                  1
                  down vote













                  Google Place API requires the referer HTTP header to be included when making the API call.



                  Include HTTP header "Referer:yourdomain.com" and this should fix the response issues.






                  share|improve this answer



















                  • 1




                    While this may answer the question it’s always a good idea to put some text in your answer to explain what you're doing. Read how to write a good answer. Also, you should include some code.
                    – Jørgen R
                    Mar 4 '15 at 7:42










                  • Could you please provide a snippet
                    – Sagar Devanga
                    Jun 13 '15 at 7:04










                  • Here's what I did, and it worked perfectly: var options = { url: url, headers:{ Referer:'xxx.herokuapp.com' } }; request.get(options, function(...
                    – Florida G.
                    Feb 21 '17 at 20:06















                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote









                  Google Place API requires the referer HTTP header to be included when making the API call.



                  Include HTTP header "Referer:yourdomain.com" and this should fix the response issues.






                  share|improve this answer














                  Google Place API requires the referer HTTP header to be included when making the API call.



                  Include HTTP header "Referer:yourdomain.com" and this should fix the response issues.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Mar 6 '15 at 19:11

























                  answered Mar 4 '15 at 5:49









                  Ramesh

                  1,4691413




                  1,4691413








                  • 1




                    While this may answer the question it’s always a good idea to put some text in your answer to explain what you're doing. Read how to write a good answer. Also, you should include some code.
                    – Jørgen R
                    Mar 4 '15 at 7:42










                  • Could you please provide a snippet
                    – Sagar Devanga
                    Jun 13 '15 at 7:04










                  • Here's what I did, and it worked perfectly: var options = { url: url, headers:{ Referer:'xxx.herokuapp.com' } }; request.get(options, function(...
                    – Florida G.
                    Feb 21 '17 at 20:06
















                  • 1




                    While this may answer the question it’s always a good idea to put some text in your answer to explain what you're doing. Read how to write a good answer. Also, you should include some code.
                    – Jørgen R
                    Mar 4 '15 at 7:42










                  • Could you please provide a snippet
                    – Sagar Devanga
                    Jun 13 '15 at 7:04










                  • Here's what I did, and it worked perfectly: var options = { url: url, headers:{ Referer:'xxx.herokuapp.com' } }; request.get(options, function(...
                    – Florida G.
                    Feb 21 '17 at 20:06










                  1




                  1




                  While this may answer the question it’s always a good idea to put some text in your answer to explain what you're doing. Read how to write a good answer. Also, you should include some code.
                  – Jørgen R
                  Mar 4 '15 at 7:42




                  While this may answer the question it’s always a good idea to put some text in your answer to explain what you're doing. Read how to write a good answer. Also, you should include some code.
                  – Jørgen R
                  Mar 4 '15 at 7:42












                  Could you please provide a snippet
                  – Sagar Devanga
                  Jun 13 '15 at 7:04




                  Could you please provide a snippet
                  – Sagar Devanga
                  Jun 13 '15 at 7:04












                  Here's what I did, and it worked perfectly: var options = { url: url, headers:{ Referer:'xxx.herokuapp.com' } }; request.get(options, function(...
                  – Florida G.
                  Feb 21 '17 at 20:06






                  Here's what I did, and it worked perfectly: var options = { url: url, headers:{ Referer:'xxx.herokuapp.com' } }; request.get(options, function(...
                  – Florida G.
                  Feb 21 '17 at 20:06












                  up vote
                  1
                  down vote













                  Also the corresponding API should be enabled for the given project



                  https://console.developers.google.com/apis/library?project=projectnamehere






                  share|improve this answer

























                    up vote
                    1
                    down vote













                    Also the corresponding API should be enabled for the given project



                    https://console.developers.google.com/apis/library?project=projectnamehere






                    share|improve this answer























                      up vote
                      1
                      down vote










                      up vote
                      1
                      down vote









                      Also the corresponding API should be enabled for the given project



                      https://console.developers.google.com/apis/library?project=projectnamehere






                      share|improve this answer












                      Also the corresponding API should be enabled for the given project



                      https://console.developers.google.com/apis/library?project=projectnamehere







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Nov 19 '15 at 18:09









                      dav

                      5,344655105




                      5,344655105






















                          up vote
                          -1
                          down vote













                          I faced the problem because i did not enable the APL key in Google console.






                          share|improve this answer

























                            up vote
                            -1
                            down vote













                            I faced the problem because i did not enable the APL key in Google console.






                            share|improve this answer























                              up vote
                              -1
                              down vote










                              up vote
                              -1
                              down vote









                              I faced the problem because i did not enable the APL key in Google console.






                              share|improve this answer












                              I faced the problem because i did not enable the APL key in Google console.







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Dec 19 '16 at 10:29









                              Shainu Thomas

                              125110




                              125110






















                                  up vote
                                  -1
                                  down vote













                                    url = https://maps.googleapis.com/maps/api/directions/json?origin=19.0176147,72.8561644&destination=28.65381,77.22897&mode=driving&key=AIzaSyATaUNPUjc5rs0lVp2Z_spnJle-AvhKLHY


                                  add only in AppDelegate like



                                              GMSServices.provideAPIKey("AIzaSyATaUNPUjc5rs0lVp2Z_spnJle-AvhKLHY")


                                  and remove the key in this url.



                                  now url is



                                  https://maps.googleapis.com/maps/api/directions/json?origin=19.0176147,72.8561644&destination=28.65381,77.22897&mode=driving





                                  share|improve this answer



























                                    up vote
                                    -1
                                    down vote













                                      url = https://maps.googleapis.com/maps/api/directions/json?origin=19.0176147,72.8561644&destination=28.65381,77.22897&mode=driving&key=AIzaSyATaUNPUjc5rs0lVp2Z_spnJle-AvhKLHY


                                    add only in AppDelegate like



                                                GMSServices.provideAPIKey("AIzaSyATaUNPUjc5rs0lVp2Z_spnJle-AvhKLHY")


                                    and remove the key in this url.



                                    now url is



                                    https://maps.googleapis.com/maps/api/directions/json?origin=19.0176147,72.8561644&destination=28.65381,77.22897&mode=driving





                                    share|improve this answer

























                                      up vote
                                      -1
                                      down vote










                                      up vote
                                      -1
                                      down vote









                                        url = https://maps.googleapis.com/maps/api/directions/json?origin=19.0176147,72.8561644&destination=28.65381,77.22897&mode=driving&key=AIzaSyATaUNPUjc5rs0lVp2Z_spnJle-AvhKLHY


                                      add only in AppDelegate like



                                                  GMSServices.provideAPIKey("AIzaSyATaUNPUjc5rs0lVp2Z_spnJle-AvhKLHY")


                                      and remove the key in this url.



                                      now url is



                                      https://maps.googleapis.com/maps/api/directions/json?origin=19.0176147,72.8561644&destination=28.65381,77.22897&mode=driving





                                      share|improve this answer














                                        url = https://maps.googleapis.com/maps/api/directions/json?origin=19.0176147,72.8561644&destination=28.65381,77.22897&mode=driving&key=AIzaSyATaUNPUjc5rs0lVp2Z_spnJle-AvhKLHY


                                      add only in AppDelegate like



                                                  GMSServices.provideAPIKey("AIzaSyATaUNPUjc5rs0lVp2Z_spnJle-AvhKLHY")


                                      and remove the key in this url.



                                      now url is



                                      https://maps.googleapis.com/maps/api/directions/json?origin=19.0176147,72.8561644&destination=28.65381,77.22897&mode=driving






                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      edited Aug 21 at 12:21









                                      Pascal L.

                                      895517




                                      895517










                                      answered Aug 21 at 11:43









                                      Abubakar Bizimana

                                      12




                                      12






























                                           

                                          draft saved


                                          draft discarded



















































                                           


                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function () {
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f21933247%2fthis-ip-site-or-mobile-application-is-not-authorized-to-use-this-api-key%23new-answer', 'question_page');
                                          }
                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown







                                          Popular posts from this blog

                                          Full-time equivalent

                                          さくらももこ

                                          13 indicted, 8 arrested in Calif. drug cartel investigation