applicationDefault method

Credential applicationDefault([
  1. Agent httpAgent
])

Returns a credential created from the {@link https://developers.google.com/identity/protocols/application-default-credentials | Google Application Default Credentials} that grants admin access to Firebase services. This credential can be used in the call to {@link firebase-admin.app#initializeApp}.

Google Application Default Credentials are available on any Google infrastructure, such as Google App Engine and Google Compute Engine.

See {@link https://firebase.google.com/docs/admin/setup#initialize_the_sdk | Initialize the SDK} for more details.

@example

initializeApp({
  credential: applicationDefault(),
  databaseURL: "https://<DATABASE_NAME>.firebaseio.com"
});

@param httpAgent - Optional {@link https://nodejs.org/api/http.html#http_class_http_agent | HTTP Agent} to be used when retrieving access tokens from Google token servers.

@returns A credential authenticated via Google Application Default Credentials that can be used to initialize an app.

Implementation

external Credential applicationDefault([Agent httpAgent]);