0

I am trying to activate google maps on the page. I install composer API without problem. And added my server/domain IP in google API. checked and added the API key into config file. After that set the Controller and the Route which is like below.

My Route:

Route::get('/', 'PagesController@map');

Here is my Controller:

public function map()
{
    $response = \GoogleMaps::load('geocoding')
        ->setParam(['address' => 'tokyo'])
        ->get();

    return view('welcome', compact('response'));
}

And I am calling it on my view:

{{ isset($response) ? $response : '' }}

But I'm gettin this error?

{ "error_message" : "This API project is not authorized to use this API.", "results" : [], "status" : "REQUEST_DENIED" }

Any idea why is this happening? Do I need to add some script on view? Thank you for your help!

firefly
  • 876
  • 2
  • 15
  • 42
  • Did you check this anwser? https://stackoverflow.com/questions/32994634/this-api-project-is-not-authorized-to-use-this-api-please-ensure-that-this-api – Khoa TruongDinh Nov 01 '18 at 02:14
  • yea I checked it already but no effects on mine. Do i need to add some script on the view? – firefly Nov 02 '18 at 02:32

1 Answers1

1

Go to Developer Console -> APIs & auth -> APIs Enable Google Maps Geocoding and Google Maps Geolocation API

Tai Ho
  • 546
  • 4
  • 9
  • it s actually no effects already enabled the geocoding. But when I calling api on view do I need to add some script? – firefly Nov 02 '18 at 02:33