admin
admin is a global namespace from which all the Firebase Admin services are accessed.
Interface
FirebaseError
Namespaces
auth
credential
database
messaging
Properties
apps
non-null Array of admin.app.App
A (read-only) array of all initialized apps.
SDK_VERSION
string
The current SDK version.
Methods
app
app(name) returns admin.app.App
Retrieves a Firebase app instance.
When called with no arguments, the default app is returned. When an app name is provided, the app corresponding to that name is returned.
An exception is thrown if the app being retrieved has not yet been initialized.
Parameter |
|
|---|---|
|
name |
Optional string Optional name of the app to return. If no name is provided, the default is |
- Returns
-
non-null admin.app.AppThe app corresponding to the provided app name. If no app name is provided, the default app is returned.
Examples
// Return the default app
var app = admin.app();
// Return a named app
var otherApp = admin.app("otherApp");
initializeApp
initializeApp(options, name) returns admin.app.App
Creates and initializes a Firebase app instance.
See Initialize the SDK and Initialize multiple apps for detailed documentation.
Parameter |
|
|---|---|
|
options |
Object Options to configure the app's services. Value must not be null. |
|
name |
Optional string Optional name of the app to initialize. If no name is provided, the default is |
- Returns
-
non-null admin.app.AppThe initialized app.
Examples
// Initialize default app
admin.initializeApp({
credential: <CREDENTIAL>,
databaseURL: "https://<DATABASE_NAME>.firebaseio.com"
});
// Initialize another app
var otherApp = admin.initializeApp({
credential: <OTHER_CREDENTIAL>,
databaseURL: "https://<OTHER_DATABASE_NAME>.firebaseio.com",
databaseAuthVariableOverride: {
uid: "some-uid"
}
}, "otherApp");

