Jump to top

app-check

interface

The Firebase App Check service is available for the default app or a given app.

Example 1

Get the appCheck instance for the default app:

const appCheckForDefaultApp = firebase.appCheck();
Example 2

Get the appCheck instance for a secondary app: ˚

const otherApp = firebase.app('otherApp');
const appCheckForOtherApp = firebase.appCheck(otherApp);

Properties

app

</>

The current FirebaseApp instance for this Firebase service.

Methods

activate

</>

Activate App Check On iOS App Check is activated with DeviceCheck provider simply by including the module, using the token auto refresh default or the specific value (if configured) in firebase.json, but calling this does no harm. On Android you must call this and it will install the SafetyNet provider in release builds, the Debug provider if debuggable. On both platforms you may use this method to alter the token refresh setting after startup. On iOS if you want to set a specific AppCheckProviderFactory (for instance to FIRAppCheckDebugProviderFactory or FIRAppAttestProvider) you must manually do that in your AppDelegate.m prior to calling [FIRApp configure]

activate(siteKeyOrProvider: string | AppCheckProvider, isTokenAutoRefreshEnabled?: undefined | false | true): Promise<void>;

getToken

</>

Requests Firebase App Check token. This method should only be used if you need to authorize requests to a non-Firebase backend. Requests to Firebase backend are authorized automatically if configured.

getToken(forceRefresh?: undefined | false | true): Promise<AppCheckTokenResult>;

setTokenAutoRefreshEnabled

</>

Alter the token auto refresh setting. By default it will take the value of automaticDataCollectionEnabled from Info.plist / AndroidManifest.xml

setTokenAutoRefreshEnabled(isTokenAutoRefreshEnabled: boolean): void;