umts / pvta-multiplatform

Transit realtime app for mobile devices
Other
6 stars 5 forks source link

Maps API not working on the web for directions drop-down #487

Closed werebus closed 5 years ago

werebus commented 5 years ago

image

In the console:

This API project is not authorized to use this API. Please ensure this API is activated in the Google Developers Console: https://console.developers.google.com/apis/api/places_backend?project=_ For more information on authentication and Google Maps JavaScript API services please see: https://developers.google.com/maps/documentation/javascript/get-api-key js:76:50
    _.Gc https://maps.googleapis.com/maps/api/js:76:50
    R2/< https://maps.googleapis.com/maps-api-v3/api/js/34/16/places_impl.js:7:62
    O2/< https://maps.googleapis.com/maps-api-v3/api/js/34/16/places_impl.js:5:431
    e https://maps.googleapis.com/maps-api-v3/api/js/34/16/places_impl.js:4:143
    c https://maps.googleapis.com/maps-api-v3/api/js/34/16/common.js:47:82
    <anonymous> https://maps.googleapis.com/maps/api/place/js/AutocompletionService.GetPredictions:1:22

I don't think that this is related to #485, but there's a chance.

mboneil10 commented 5 years ago

Oh, interesting

mboneil10 commented 5 years ago

@werebus, is this also on iOS like #485?

werebus commented 5 years ago

Nope. It's on the web platform (https://m.pvta.com/#/plan-trip).

mboneil10 commented 5 years ago

Oh, sorry. Reread the title of the issue right now. Thanks

mboneil10 commented 5 years ago

I've looked into this and fixed the dropdown in development. I was able to do so by adding these APIs:

I wonder if this is related to #485, since the dropdown on android is also not functioning properly.

mboneil10 commented 5 years ago

The thing that's stopping me from making this change to the other API keys is that I'm not sure if we need the Geocoding API to be added. Afterall, it is part of the Google Maps JavaScript API (currently the only API we're using on PVTrAck).

Update: all good! Deleting the Geocoding API made no difference

mboneil10 commented 5 years ago

The problem was occurring in the autocomplete of the plan trip/the schedule page. So autocomplete relies on Places. I enabled that API.

To double check, I looked at the API picker on Google Maps Platform, which indicates that Places API includes the following request:

Place Autocomplete automatically fills in the name and/or address of a place as users type.

mboneil10 commented 5 years ago

TLDR -- Enabling the Places API on Google Cloud fixes the problem in development. Should I do the same for production?

Please let me know if this sounds like a good idea @sherson, @anbranin, @werebus, and I'll make the proper changes. 👍

werebus commented 5 years ago

I think our app does use the Geocoding API to encode the user's current location into a place name.

werebus commented 5 years ago

Yes, if our app uses a particular API, that API needs to be enabled. And, at least for now, all of the versions of our app — iOS, Android, Web — use the same APIs.

mboneil10 commented 5 years ago

Got it! Enabling them for production now.

mboneil10 commented 5 years ago

Errr the autocomplete works on web, but I keep getting this message...

screen shot 2018-11-19 at 9 25 25 am
mboneil10 commented 5 years ago

Enabled Directions API, all good.

mboneil10 commented 5 years ago

After adding the APIs, looks good to me. Will reopen if there still seems to me an issue.