google-maps-services-java icon indicating copy to clipboard operation
google-maps-services-java copied to clipboard

Places api uses client id (enterprise credentials) instead of apikey when both are configured

Open deconinckd opened this issue 3 years ago • 1 comments

Hello,

We have an application that uses the Google API for PlacesAPI, TimeZoneApi and GeoCodingAPI.

Now we have a GeoContext spring bean defined where we set the API key and the Enterprise credentials. Which we inject in our service to use for the calls to the api's

// Config class
builder.apiKey(googleApiKey);
builder.enterpriseCredentials(googleClientId, googleCryptoKey);
builder.channel(googleChannel);	

// Call in the service
PlaceAutocompleteRequest request = PlacesApi.placeAutocomplete(context, query, googleSesionKey).language("en").await();

Whenever we do a call to the placesAPI then it builds the url like below with the client and signature instead of the apiKey

https://maps.googleapis.com/maps/api/place/autocomplete/json?client=XXXXXXX&input=fa&types=%28cities%29&language=en&sessiontoken=bb1fb770-76ec-42da-b80b-7ab82dd74f23&signature=XXXX

this gives us back an error stating that an api key must be provided.

During debugging of the placesApi I notice that it adds this clientid instead of APIKey when it is provided and because of a setting canuseclient is set to true.

Is this a bug that the placesapi config is wrong as it should not seem to use this clientid? I am also not sure where this can be modified to false.

Thanks

deconinckd avatar May 25 '22 08:05 deconinckd

This wasn't me. Someone hacked into my account. I have no idea what they're trying to do. What are you? Google Maps support?

On Wed, May 25, 2022, 4:30 AM deconinckd @.***> wrote:

Hello,

We have an application that uses the Google API for PlacesAPI, TimeZoneApi and GeoCodingAPI.

Now we have a GeoContext spring bean defined where we set the API key and the Enterprise credentials. Which we inject in our service to use for the calls to the api's

// Config class builder.apiKey(googleApiKey); builder.enterpriseCredentials(googleClientId, googleCryptoKey); builder.channel(googleChannel);

// Call in the service PlaceAutocompleteRequest request = PlacesApi.placeAutocomplete(context, query, googleSesionKey).language("en").await();

Whenever we do a call to the placesAPI then it builds the url like below with the client and signature instead of the apiKey

https://maps.googleapis.com/maps/api/place/autocomplete/json?client=XXXXXXX&input=fa&types=%28cities%29&language=en&sessiontoken=bb1fb770-76ec-42da-b80b-7ab82dd74f23&**signature=XXXX **

this gives us back an error stating that an api key must be provided.

During debugging of the placesApi I notice that it adds this clientid instead of APIKey when it is provided and because of a setting canuseclient is set to true.

Is this a bug that the placesapi config is wrong as it should not seem to use this clientid? I am also not sure where this can be modified to false.

Thanks

— Reply to this email directly, view it on GitHub https://github.com/googlemaps/google-maps-services-java/issues/828, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZH7STPH636V65PGMM2KE4DVLXQLXANCNFSM5W4JNCUA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

TheEruditePolymath avatar May 25 '22 12:05 TheEruditePolymath