admin.app. App
A Firebase app holds the initialization information for a collection of services.
Do not call this constructor directly. Instead, use
admin.initializeApp()
to create an app.
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 Object
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.AuthTheAuthservice for the current app.
Example
var auth = app.auth();
// The above is shorthand for:
// var auth = admin.auth(app);
database
database() returns admin.database.Database
Gets the Database service for the current app.
- Returns
-
non-null admin.database.DatabaseTheDatabaseservice for the current app.
Example
var database = app.database();
// The above is shorthand for:
// var database = admin.database(app);
delete
delete() returns Promise containing void
Renders this app unusable and frees the resources of all associated services.
- Returns
-
non-null Promise containing voidAn 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);
});
messaging
messaging() returns admin.messaging.Messaging
Gets the Messaging service for the current app.
- Returns
-
non-null admin.messaging.MessagingTheMessagingservice for the current app.
Example
var messaging = app.messaging();
// The above is shorthand for:
// var messaging = admin.messaging(app);

