React Native Firebase
    Preparing search index...

    App Check module instance - returned from firebase.appCheck() or firebase.app().appCheck()

    interface AppCheck {
        app: ReactNativeFirebase.FirebaseApp;
        activate(
            siteKeyOrProvider: string | AppCheckProvider,
            isTokenAutoRefreshEnabled?: boolean,
        ): Promise<void>;
        getLimitedUseToken(): Promise<AppCheckTokenResult>;
        getToken(forceRefresh?: boolean): Promise<AppCheckTokenResult>;
        initializeAppCheck(options: AppCheckOptions): Promise<void>;
        newReactNativeFirebaseAppCheckProvider(): ReactNativeFirebaseAppCheckProvider;
        onTokenChanged(
            observer: PartialObserver<AppCheckListenerResult>,
        ): () => void;
        onTokenChanged(
            onNext: (tokenResult: AppCheckListenerResult) => void,
            onError?: (error: Error) => void,
            onCompletion?: () => void,
        ): () => void;
        setTokenAutoRefreshEnabled(isTokenAutoRefreshEnabled: boolean): void;
    }

    Hierarchy (View Summary)

    Index

    Methods

    • 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]

      Parameters

      • siteKeyOrProvider: string | AppCheckProvider

        This is ignored, Android uses DebugProviderFactory if the app is debuggable (https://firebase.google.com/docs/app-check/android/debug-provider) Android uses PlayIntegrityProviderFactory for release builds. iOS uses DeviceCheckProviderFactory by default unless altered in AppDelegate.m manually

      • OptionalisTokenAutoRefreshEnabled: boolean

        If true, enables SDK to automatically refresh AppCheck token as needed. If undefined, the value will default to the value of app.automaticDataCollectionEnabled. That property defaults to false and can be set in the app config.

      Returns Promise<void>

      use initializeAppCheck to gain access to all platform providers and firebase-js-sdk v9 compatibility

    • 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.

      Parameters

      • OptionalforceRefresh: boolean

        If true, a new Firebase App Check token is requested and the token cache is ignored. If false, the cached token is used if it exists and has not expired yet. In most cases, false should be used. True should only be used if the server explicitly returns an error, indicating a revoked token.

      Returns Promise<AppCheckTokenResult>

    • 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

      Parameters

      • options: AppCheckOptions

        an AppCheckOptions with a configured ReactNativeFirebaseAppCheckProvider as the provider

      Returns Promise<void>

    • 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.

      Returns () => void

      A function that unsubscribes this listener.

    • 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.

      Token listeners do not exist in the native SDK for iOS, no token change events will be emitted on that platform. This is not yet implemented on Android, no token change events will be emitted until implemented.

      NOTE: Although an onError callback can be provided, it will never be called, Android sdk code doesn't provide handling for onError function

      NOTE: Although an onCompletion callback can be provided, it will never be called because the token stream is never-ending.

      Parameters

      • onNext: (tokenResult: AppCheckListenerResult) => void
      • OptionalonError: (error: Error) => void
      • OptionalonCompletion: () => void

      Returns () => void

      A function that unsubscribes this listener.

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

      Parameters

      • isTokenAutoRefreshEnabled: boolean

        If true, the SDK automatically refreshes App Check tokens as needed. This overrides any value set during activate() or taken by default from automaticDataCollectionEnabled in plist / android manifest

      Returns void

    Properties

    The FirebaseApp this module is associated with