kevmo314
kevmo314

Reputation: 4317

Authenticating Firebase Admin SDK on GCE VM with Application Default Credentials

I can't seem to authenticate with the Firebase Admin SDK on a GCE VM. With

admin.initializeApp({
  credential: admin.credential.applicationDefault(),
  databaseURL: `https://${PROJECT_ID}-default-rtdb.firebaseio.com`,
});

my app indicates

Error: 7 PERMISSION_DENIED: Request had insufficient authentication scopes.

From what I can tell, this is because the scopes are missing on the Application Default Credentials? Isn't this supposed to be configured automatically?

I've verified that if I take the compute service account, generate a json key, and then pass it to the admin sdk manually everything works, so I'm not clear why it doesn't correctly fetch the credentials.

Upvotes: 0

Views: 308

Answers (1)

kevmo314
kevmo314

Reputation: 4317

Turns out there's a checkbox that needs to be checked when creating the instance

enter image description here

Upvotes: 2

Related Questions