You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like service account impersonation is the recommended way to authenticate for local development.
But it's not very clear how this is done in practice. Do I need to adapt my code for this?
I've run:
gcloud auth application-default login --impersonate-service-account SERVICE_ACCT_EMAIL
and I have a token in:
cat /Users/myuser/.config/gcloud/application_default_credentials.json
"Getting metadata from plugin failed with error: Could not refresh access token: PERMISSION_DENIED: unable to impersonate: Permission 'iam.serviceAccounts.getAccessToken' denied on resource (or it may not exist).",
My local user has the Owner role in the GCP project. And has owner permissions on the service account. The service account has the Service Account Token Creator role.
Im using firebase-admin v13.0.1
Some working sample code for this would be very helpful.
The text was updated successfully, but these errors were encountered:
I think the principal (user) trying to impersonate the service account should also have the Service Account Token Creator role. See: https://stackoverflow.com/a/76378259
To ensure that the principal has the necessary permission to impersonate a service account, ask your administrator to grant the principal the Service Account Token Creator (roles/iam.serviceAccountTokenCreator) IAM role on the service account.
My account has the Owner role, and that includes all the necessary permissions afaik. I have also tried adding Service Account Token Creator role. But that makes no difference.
// using code like this
credential: applicationDefault(),
I still get:
Getting metadata from plugin failed with error: Could not refresh access token: PERMISSION_DENIED: unable to impersonate: Permission 'iam.serviceAccounts.getAccessToken' denied on resource (or it may not exist).
It seems like service account impersonation is the recommended way to authenticate for local development.
But it's not very clear how this is done in practice. Do I need to adapt my code for this?
I've run:
gcloud auth application-default login --impersonate-service-account SERVICE_ACCT_EMAIL
and I have a token in:
cat /Users/myuser/.config/gcloud/application_default_credentials.json
I have tried code like this (after having looked at #2800):
But then I got an error:
and this, I assumed this would pick up the ADC credentials file, notice its impersonation, and things would just work:
But then I got this error:
My local user has the Owner role in the GCP project. And has owner permissions on the service account. The service account has the
Service Account Token Creator
role.Im using
firebase-admin
v13.0.1Some working sample code for this would be very helpful.
The text was updated successfully, but these errors were encountered: