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);

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 if you call this it will install the PlayIntegrity 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>;

getLimitedUseToken

</>

Requests a Firebase App Check token. This method should be used only if you need to authorize requests to a non-Firebase backend. Returns limited-use tokens that are intended for use with your non-Firebase backend endpoints that are protected with Replay Protection (https://firebase.google.com/docs/app-check/custom-resource-backend#replay-protection). This method does not affect the token generation behavior of the getAppCheckToken() method.

getLimitedUseToken(): Promise<AppCheckTokenResult>;

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>;

initializeAppCheck

</>

initialize the AppCheck module. Note that in react-native-firebase AppCheckOptions must always be an object with a provider member containing ReactNativeFirebaseAppCheckProvider that has returned successfully from a call to the configure method, with sub-providers for the various platforms configured to meet your project requirements. This must be called prior to interacting with any firebase services protected by AppCheck

initializeAppCheck(options: AppCheckOptions): Promise<void>;

newReactNativeFirebaseAppCheckProvider

</>

create a ReactNativeFirebaseAppCheckProvider option for use in react-native-firebase

newReactNativeFirebaseAppCheckProvider(): ReactNativeFirebaseAppCheckProvider;

onTokenChanged

</>
Signature 1
</>

Registers a listener to changes in the token state. There can be more than one listener registered at the same time for one or more App Check instances. The listeners call back on the UI thread whenever the current token associated with this App Check instance changes.

onTokenChanged(observer: PartialObserver<AppCheckListenerResult>): () => void;
Signature 2
</>

Registers a listener to changes in the token state. There can be more than one listener registered at the same time for one or more App Check instances. The listeners call back on the UI thread whenever the current token associated with this App Check instance changes.

onTokenChanged(onNext: (tokenResult: AppCheckListenerResult) => void, onError?: undefined | (error: Error) => void, onCompletion?: undefined | () => void): () => void;

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;