Open ErikCoup opened 1 year ago
I'm having the same issue. Very frustrating. Any progress on this one?
I have also ran into this issue
If you've landed here it's good to know that others have contributed some code for a functional workaround in the above mentioned thread, starting here: https://github.com/googleapis/google-auth-library-nodejs/issues/916#issuecomment-2068887740
It seems that making API calls (e.g., to the Google Drive API) impersonating another user via Domain-Wide Delegation only works when creating a client using the
keyFile
option (and not when relying on automatically provided auth credentials).Specifically, I am trying to call the Google Drive API from a Google Cloud Function. I rely on the "Default App Engine Service Account" for authorizing my client:
The above code works, but requests are not made as
email@to.impersonate
, but instead as the Default App Engine Service Account. To be clear, I have configured Domain-Wide Delegation for the Default App Engine Service Account in the Google Workspaces Admin UI (https://admin.google.com).Now, the above code does work once I slightly extend it by providing the Default App Engine Service Account's credentials via the
keyFile
option:Ideally, I'd like to avoid having to manually provide the Default App Engine Service Account credentials using a file.
It seems this issue was mentioned as part of discussions around https://github.com/googleapis/google-auth-library-nodejs/issues/916, specifically in this comment https://github.com/googleapis/google-auth-library-nodejs/issues/916#issuecomment-1080595410.
Environment details
googleapis
version: 105.0.0