firebase-admin package Stay organized with collections Save and categorize content based on your preferences.
Firebase namespaced API (legacy).
Functions
| Function | Description |
|---|---|
| app(name) | |
| appCheck(app) | Gets theAppCheck service for the default app or a given app.admin.appCheck() can be called with no arguments to access the default app'sAppCheck service or asadmin.appCheck(app) to access theAppCheck service associated with a specific app. |
| auth(app) | Gets theAuth service for the default app or a given app.admin.auth() can be called with no arguments to access the default app'sAuth service or asadmin.auth(app) to access theAuth service associated with a specific app. |
| database(app) | Gets theDatabase service for the default app or a given app.admin.database() can be called with no arguments to access the default app'sDatabase service or asadmin.database(app) to access theDatabase service associated with a specific app.admin.database is also a namespace that can be used to access global constants and methods associated with theDatabase service. |
| firestore(app) | |
| initializeApp(options, name) | |
| installations(app) | Gets theInstallations service for the default app or a given app.admin.installations() can be called with no arguments to access the default app'sInstallations service or asadmin.installations(app) to access theInstallations service associated with a specific app. |
| instanceId(app) | Gets theInstanceId service for the default app or a given app.admin.instanceId() can be called with no arguments to access the default app'sInstanceId service or asadmin.instanceId(app) to access theInstanceId service associated with a specific app. |
| machineLearning(app) | Gets theMachineLearning service for the default app or a given app.admin.machineLearning() can be called with no arguments to access the default app'sMachineLearning service or asadmin.machineLearning(app) to access theMachineLearning service associated with a specific app. |
| messaging(app) | Gets theMessaging service for the default app or a given app.admin.messaging() can be called with no arguments to access the default app'sMessaging service or asadmin.messaging(app) to access theMessaging service associated with a specific app. |
| projectManagement(app) | Gets theProjectManagement service for the default app or a given app.admin.projectManagement() can be called with no arguments to access the default app'sProjectManagement service, or asadmin.projectManagement(app) to access theProjectManagement service associated with a specific app. |
| remoteConfig(app) | Gets theRemoteConfig service for the default app or a given app.admin.remoteConfig() can be called with no arguments to access the default app'sRemoteConfig service or asadmin.remoteConfig(app) to access theRemoteConfig service associated with a specific app. |
| securityRules(app) | Gets theSecurityRules service for the default app or a given app.admin.securityRules() can be called with no arguments to access the default app'sSecurityRules service, or asadmin.securityRules(app) to access theSecurityRules service associated with a specific app. |
| storage(app) | Gets the service for the default app or a given app.admin.storage() can be called with no arguments to access the default app'sStorage service or asadmin.storage(app) to access theStorage service associated with a specific app. |
Interfaces
| Interface | Description |
|---|---|
| AppOptions | Available options to pass toinitializeApp(). |
| FirebaseArrayIndexError | Composite type which includes both aFirebaseError object and an index which can be used to get the errored item. |
| FirebaseError | FirebaseError is a subclass of the standard JavaScriptError object. In addition to a message string and stack trace, it contains a string code. |
| GoogleOAuthAccessToken | Interface for Google OAuth 2.0 access tokens. |
| ServiceAccount |
Namespaces
| Namespace | Description |
|---|---|
| app | |
| appCheck | |
| auth | |
| credential | |
| database | |
| firestore | |
| installations | |
| instanceId | |
| machineLearning | |
| messaging | |
| projectManagement | |
| remoteConfig | |
| securityRules | |
| storage |
Variables
| Variable | Description |
|---|---|
| apps | |
| SDK_VERSION |
app(name)
Signature:
exportdeclarefunctionapp(name?:string):app.App;Parameters
| Parameter | Type | Description |
|---|---|---|
| name | string |
Returns:
appCheck(app)
Gets theAppCheck service for the default app or a given app.
admin.appCheck() can be called with no arguments to access the default app'sAppCheck service or asadmin.appCheck(app) to access theAppCheck service associated with a specific app.
Signature:
exportdeclarefunctionappCheck(app?:App):appCheck.AppCheck;Parameters
| Parameter | Type | Description |
|---|---|---|
| app | App | Optional app for which to return theAppCheck service. If not provided, the defaultAppCheck service is returned. |
Returns:
The defaultAppCheck service if no app is provided, or theAppCheck service associated with the provided app.
Example 1
// Get the `AppCheck` service for the default appvardefaultAppCheck=admin.appCheck();Example 2
// Get the `AppCheck` service for a given appvarotherAppCheck=admin.appCheck(otherApp);auth(app)
Gets theAuth service for the default app or a given app.
admin.auth() can be called with no arguments to access the default app'sAuth service or asadmin.auth(app) to access theAuth service associated with a specific app.
Signature:
exportdeclarefunctionauth(app?:App):auth.Auth;Parameters
| Parameter | Type | Description |
|---|---|---|
| app | App |
Returns:
Example 1
// Get the Auth service for the default appvardefaultAuth=admin.auth();Example 2
// Get the Auth service for a given appvarotherAuth=admin.auth(otherApp);database(app)
Gets theDatabase service for the default app or a given app.
admin.database() can be called with no arguments to access the default app'sDatabase service or asadmin.database(app) to access theDatabase service associated with a specific app.
admin.database is also a namespace that can be used to access global constants and methods associated with theDatabase service.
Signature:
exportdeclarefunctiondatabase(app?:App):database.Database;Parameters
| Parameter | Type | Description |
|---|---|---|
| app | App |
Returns:
The defaultDatabase service if no app is provided or theDatabase service associated with the provided app.
Example 1
// Get the Database service for the default appvardefaultDatabase=admin.database();Example 2
// Get the Database service for a specific appvarotherDatabase=admin.database(app);firestore(app)
Signature:
exportdeclarefunctionfirestore(app?:App):_firestore.Firestore;Parameters
| Parameter | Type | Description |
|---|---|---|
| app | App |
Returns:
_firestore.Firestore
initializeApp(options, name)
Signature:
exportdeclarefunctioninitializeApp(options?:AppOptions,name?:string):app.App;Parameters
| Parameter | Type | Description |
|---|---|---|
| options | AppOptions | |
| name | string |
Returns:
installations(app)
Gets theInstallations service for the default app or a given app.
admin.installations() can be called with no arguments to access the default app'sInstallations service or asadmin.installations(app) to access theInstallations service associated with a specific app.
Signature:
exportdeclarefunctioninstallations(app?:App):installations.Installations;Parameters
| Parameter | Type | Description |
|---|---|---|
| app | App | Optional app whoseInstallations service to return. If not provided, the defaultInstallations service is returned. |
Returns:
The defaultInstallations service if no app is provided or theInstallations service associated with the provided app.
Example 1
// Get the Installations service for the default appvardefaultInstallations=admin.installations();Example 2
// Get the Installations service for a given appvarotherInstallations=admin.installations(otherApp);instanceId(app)
Gets theInstanceId service for the default app or a given app.
admin.instanceId() can be called with no arguments to access the default app'sInstanceId service or asadmin.instanceId(app) to access theInstanceId service associated with a specific app.
Signature:
exportdeclarefunctioninstanceId(app?:App):instanceId.InstanceId;Parameters
| Parameter | Type | Description |
|---|---|---|
| app | App | Optional app whoseInstanceId service to return. If not provided, the defaultInstanceId service will be returned. |
Returns:
The defaultInstanceId service if no app is provided or theInstanceId service associated with the provided app.
Example 1
// Get the Instance ID service for the default appvardefaultInstanceId=admin.instanceId();Example 2
// Get the Instance ID service for a given appvarotherInstanceId=admin.instanceId(otherApp);machineLearning(app)
Gets theMachineLearning service for the default app or a given app.
admin.machineLearning() can be called with no arguments to access the default app'sMachineLearning service or asadmin.machineLearning(app) to access theMachineLearning service associated with a specific app.
Signature:
exportdeclarefunctionmachineLearning(app?:App):machineLearning.MachineLearning;Parameters
| Parameter | Type | Description |
|---|---|---|
| app | App | Optional app whoseMachineLearning service to return. If not provided, the defaultMachineLearning service will be returned. |
Returns:
machineLearning.MachineLearning
The defaultMachineLearning service if no app is provided or theMachineLearning service associated with the provided app.
Example 1
// Get the MachineLearning service for the default appvardefaultMachineLearning=admin.machineLearning();Example 2
// Get the MachineLearning service for a given appvarotherMachineLearning=admin.machineLearning(otherApp);messaging(app)
Gets theMessaging service for the default app or a given app.
admin.messaging() can be called with no arguments to access the default app'sMessaging service or asadmin.messaging(app) to access theMessaging service associated with a specific app.
Signature:
exportdeclarefunctionmessaging(app?:App):messaging.Messaging;Parameters
| Parameter | Type | Description |
|---|---|---|
| app | App | Optional app whoseMessaging service to return. If not provided, the defaultMessaging service will be returned. |
Returns:
The defaultMessaging service if no app is provided or theMessaging service associated with the provided app.
Example 1
// Get the Messaging service for the default appvardefaultMessaging=admin.messaging();Example 2
// Get the Messaging service for a given appvarotherMessaging=admin.messaging(otherApp);projectManagement(app)
Gets theProjectManagement service for the default app or a given app.
admin.projectManagement() can be called with no arguments to access the default app'sProjectManagement service, or asadmin.projectManagement(app) to access theProjectManagement service associated with a specific app.
Signature:
exportdeclarefunctionprojectManagement(app?:App):projectManagement.ProjectManagement;Parameters
| Parameter | Type | Description |
|---|---|---|
| app | App | Optional app whoseProjectManagement service to return. If not provided, the defaultProjectManagement service will be returned. * |
Returns:
projectManagement.ProjectManagement
The defaultProjectManagement service if no app is provided or theProjectManagement service associated with the provided app.
Example 1
// Get the ProjectManagement service for the default appvardefaultProjectManagement=admin.projectManagement();Example 2
// Get the ProjectManagement service for a given appvarotherProjectManagement=admin.projectManagement(otherApp);remoteConfig(app)
Gets theRemoteConfig service for the default app or a given app.
admin.remoteConfig() can be called with no arguments to access the default app'sRemoteConfig service or asadmin.remoteConfig(app) to access theRemoteConfig service associated with a specific app.
Signature:
exportdeclarefunctionremoteConfig(app?:App):remoteConfig.RemoteConfig;Parameters
| Parameter | Type | Description |
|---|---|---|
| app | App | Optional app for which to return theRemoteConfig service. If not provided, the defaultRemoteConfig service is returned. |
Returns:
The defaultRemoteConfig service if no app is provided, or theRemoteConfig service associated with the provided app.
Example 1
// Get the `RemoteConfig` service for the default appvardefaultRemoteConfig=admin.remoteConfig();Example 2
// Get the `RemoteConfig` service for a given appvarotherRemoteConfig=admin.remoteConfig(otherApp);securityRules(app)
Gets theSecurityRules service for the default app or a given app.
admin.securityRules() can be called with no arguments to access the default app'sSecurityRules service, or asadmin.securityRules(app) to access theSecurityRules service associated with a specific app.
Signature:
exportdeclarefunctionsecurityRules(app?:App):securityRules.SecurityRules;Parameters
| Parameter | Type | Description |
|---|---|---|
| app | App | Optional app to return theSecurityRules service for. If not provided, the defaultSecurityRules service is returned. |
Returns:
The defaultSecurityRules service if no app is provided, or theSecurityRules service associated with the provided app.
Example 1
// Get the SecurityRules service for the default appvardefaultSecurityRules=admin.securityRules();Example 2
// Get the SecurityRules service for a given appvarotherSecurityRules=admin.securityRules(otherApp);storage(app)
Gets the service for the default app or a given app.
admin.storage() can be called with no arguments to access the default app'sStorage service or asadmin.storage(app) to access theStorage service associated with a specific app.
Signature:
exportdeclarefunctionstorage(app?:App):storage.Storage;Parameters
| Parameter | Type | Description |
|---|---|---|
| app | App |
Returns:
Example 1
// Get the Storage service for the default appvardefaultStorage=admin.storage();Example 2
// Get the Storage service for a given appvarotherStorage=admin.storage(otherApp);apps
Signature:
apps:(app.App|null)[]SDK_VERSION
Signature:
SDK_VERSION:stringExcept as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-11-12 UTC.