Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Google Maps Places Client] - Add the ability to impersonate a service account #5892

Open
shaunmitchellve opened this issue Dec 18, 2024 · 1 comment

Comments

@shaunmitchellve
Copy link

A screenshot that you have tested with "Try this API".

Screenshot 2024-12-18 at 2 16 55 PM

What would you like to see in the library?

When using the PlacesClient with Application Default Credentials the client works fine.

When you setup ADC with Service Account Impersonation then the client error's out with a Getting metadata from plugin failed with error: INVALID_ARGUMENT: unable to impersonate: Request contains an invalid argument. error.

I'm assuming that the client is setup to utilize the impersonation credentials properly from the ~/.conifg/gcloud/application_default_credentials.json file. The structure is different depending on if using your own Google account vs impersonating a service account.

Describe alternatives you've considered

I've tried overriding the Place Client client options with an Auth client that uses an API Key. I wasn't able to get the API Key approach to work either.

Additional context/notes

No response

@shaunmitchellve
Copy link
Author

I was able to resolve this by manually setting the scopes in the Places Client.

import {PlacesClient} from '@googlemaps/places';
const placesClient = new PlacesClient({
    scopes: ['https://www.googleapis.com/auth/cloud-platform']
 });

It would appear that the Google Map Places Client doesn't set any auth scopes by default:

places_client.js:263

static get scopes() {
        return [];
}

I would suggest at least adding in the default scope of 'https://www.googleapis.com/auth/cloud-platform'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant