-3

I'm trying this with a google maps static api key( ) added at line 31. The Key is unrestricted, & I can even see error "403" on api dashboard. Why I'm getting error 403 even after entering key?

dashboard

I was able to get images using API key only till few ours back, here's the screenshot

enter image description here

I even tried this with different project & keys like google web tool to signed url

Taazar
  • 1,545
  • 18
  • 27
sholi
  • 1
  • 4

1 Answers1

1

Welcome to StackOverflow!

Based on Maps Static API - Error Messages, getting 403 Forbidden means the API key included in the request is invalid. Please check thoroughly with the Get API Key and Signature and Dashboard that you are generating and using the correct API key.

Andreas
  • 2,455
  • 10
  • 21
  • 24
  • can't I use api via unsigned usage? – sholi Nov 14 '18 at 08:23
  • quoted from the page "Requests to the Maps Static API should include a signature parameter, containing a digital signature which you must generate using a shared URL signing secret. Your shared secret is available on the Google Cloud Platform Console." – Andreas Nov 14 '18 at 08:24
  • & this code I mentioned ,can have varying parameters(latitude & longitude) ,making a signed url won't limit to map of only one location? – sholi Nov 14 '18 at 08:27
  • You can make multiple different request using the same key and signature. However, each API has their own limits to the number of requests that can be made – Andreas Nov 14 '18 at 08:29
  • it isn't working , is there any way to access map just with API key? – sholi Nov 14 '18 at 08:46
  • You can use [Google Maps Javascript API](https://developers.google.com/maps/documentation/javascript/tutorial), which only requires API key. Otherwise, simply set up the signature following the guides – Andreas Nov 14 '18 at 08:48
  • I have been making my programs with key only without any digital signature,& it was working till few hours back – sholi Nov 14 '18 at 08:49
  • Then check what changes in the last few hours and see how it can be resolved or add that to the question – Andreas Nov 14 '18 at 08:49
  • tried javascript ,didn't worked, anyway url for javascript is different from static maps – sholi Nov 14 '18 at 08:58
  • Yes it is different, since it is a different API. I would suggest for you to trace back the changes between the last time it works and now, to see what is wrong with the code – Andreas Nov 14 '18 at 09:02
  • I have been using just API key with static map url ,I can't figure out how, Is there a way possible? – sholi Nov 14 '18 at 09:08
  • Quoted from the page: "You should set up and use a digital signature in all requests. Requests without a signature might fail.". However, it never explains why it might fail – Andreas Nov 14 '18 at 09:12
  • Do you receive any specific error message than simply 403 Forbidden? And may I know why you are not able to generate and use signature along with API key? Since its usage is recommended by the documentation itself – Andreas Nov 14 '18 at 09:13
  • Because I'm unable to generate the signtaure,https://github.com/googlemaps/url-signing/blob/gh-pages/urlsigner.py I tried this code , getting error in urlparse,which is another issue – sholi Nov 14 '18 at 09:58
  • That is not the only way to generate the signature. You can check various other ways in [here](https://developers.google.com/maps/documentation/maps-static/get-api-key#dig-sig-key) – Andreas Nov 14 '18 at 10:00
  • added a screenshot – sholi Nov 14 '18 at 10:00
  • You might want to censor your API key over there. And also, try to generate your signature on the guide page linked above, and use it in your request. Also, you can try opening that request url in a web browser, to see if there is any other error messages included. – Andreas Nov 14 '18 at 10:02
  • I have already deleted that key,btw I tried key & signature combination,can u create ur own key & signature check to see if it's working? – sholi Nov 14 '18 at 11:11