firefly
firefly

Reputation: 906

Google Map Request Denied Trouble

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!

Upvotes: 0

Views: 752

Answers (1)

Tai Ho
Tai Ho

Reputation: 576

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

Upvotes: 1

Related Questions