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

Closed
shaunmitchellve opened this issue Dec 18, 2024 · 4 comments
Assignees

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'.

@sofisl
Copy link
Contributor

sofisl commented Jan 22, 2025

Got it! To clarify, is this the resolution to googleapis/google-auth-library-nodejs#1915?

Thanks for submitting this and for posting and finding the answer. I didn't know this before but I think this can and should be generated, but it's not currently being done so. I'll submit a ticket internally to fix it.

Internal f/u: cl/718235810

@sofisl sofisl added the needs more info This issue needs more information from the customer to proceed. label Jan 22, 2025
@sofisl sofisl self-assigned this Jan 22, 2025
@shaunmitchellve
Copy link
Author

Hi Sofisl,

Yes the auth scope is the fix for the other mentioned issue. I don't recall opening two issues for this but I also don't recall what I did last week so.... my memory isn't always great 😃

@github-actions github-actions bot removed the needs more info This issue needs more information from the customer to proceed. label Jan 23, 2025
@sofisl
Copy link
Contributor

sofisl commented Jan 29, 2025

Fixed by #5990

@sofisl sofisl closed this as completed Jan 29, 2025
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

2 participants