Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
592 views
in Technique[技术] by (71.8m points)

dart - Flutter : Exception caught by image resource service

HTTP request failed, status Code: 403, when I try to call Map Api in flutter Here is the screenshot Anyone please help me out

question from:https://stackoverflow.com/questions/65932341/flutter-exception-caught-by-image-resource-service

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The url shown in your screenshot returns the following message along with the 403 code:

The Google Maps Platform server rejected your request. You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started

You therefore have to do three things, in you code and on the Google cloud console:

  1. Ensure that you trap and report any error message returned from the api in order to better understand the response code.
  2. Cancel the api key that you have now published to the world and generate a new one for the Google maps api, in cloud console.
  3. Enable billing on your project otherwise Google maps api will never work as it is a chargeable service.

Hope this helps. As I said, NEVER publish api keys nor store them on GitHub or similar.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...