Properties

name

string

The (read-only) name for this app.

The default app's name is "[DEFAULT]".

Examples

// The default app's name is "[DEFAULT]"
admin.initializeApp(defaultAppConfig);
console.log(admin.app().name);  // "[DEFAULT]"
// A named app's name is what you provide to initializeApp()
var otherApp = admin.initializeApp(otherAppConfig, "other");
console.log(otherApp.name);  // "other"

options

non-null admin.app.AppOptions

The (read-only) configuration options for this app. These are the original parameters given in admin.initializeApp().

Example

var app = admin.initializeApp(config);
console.log(app.options.credential === config.credential);  // true
console.log(app.options.databaseURL === config.databaseURL);  // true

Methods

auth

auth() returns admin.auth.Auth

Gets the Auth service for the current app.

Returns

non-null admin.auth.Auth The Auth service for the current app.

Example

var auth = app.auth();
// The above is shorthand for:
// var auth = admin.auth(app);

database

database(url) returns admin.database.Database

Gets the Database service for the current app.

Parameter

url

Optional

string

Optional URL for the Database. If not provided, defaults to the URL provided in AppOptions

Returns

non-null admin.database.Database The Database service for the current app.

Examples

var database = app.database();
// The above is shorthand for:
// var database = admin.database(app);
var database = app.database('https://db-name.firebaseio.com');
// The above enables accessing another database associated with the same
// App.

delete

delete() returns Promise containing void

Renders this app unusable and frees the resources of all associated services.

Returns

non-null Promise containing void An empty promise fulfilled when the app has been deleted.

Example

app.delete()
  .then(function() {
    console.log("App deleted successfully");
  })
  .catch(function(error) {
    console.log("Error deleting app:", error);
  });

firestore

firestore() returns Object

Gets the Firestore client for the current app.

Returns

non-null Object The Firestore client for the current app.

Example

var firestore = app.firestore();
// The above is shorthand for:
// var firestore = admin.firestore(app);

instanceId

instanceId() returns admin.instanceId.InstanceId

Gets the InstanceId service for the current app.

Returns

non-null admin.instanceId.InstanceId The InstanceId service for the current app.

Example

var instanceId = app.instanceId();
// The above is shorthand for:
// var instanceId = admin.instanceId(app);

messaging

messaging() returns admin.messaging.Messaging

Gets the Messaging service for the current app.

Returns

non-null admin.messaging.Messaging The Messaging service for the current app.

Example

var messaging = app.messaging();
// The above is shorthand for:
// var messaging = admin.messaging(app);

storage

storage() returns admin.storage.Storage

Gets the Storage service for the current app.

Returns

non-null admin.storage.Storage The Storage service for the current app.

Example

var storage = app.storage();
// The above is shorthand for:
// var storage = admin.storage(app);