devsite/tools/jazzy/templates

FirebaseAppCheck Framework Reference

FIRAppCheck


@interface FIRAppCheck : NSObject

A class used to manage app check tokens for a given Firebase app.

  • Unavailable

    Undocumented

    Declaration

    Objective-C

    - (instancetype)init NS_UNAVAILABLE;
  • Returns a default instance of AppCheck.

    Declaration

    Objective-C

    + (nonnull instancetype)appCheck;

    Return Value

    An instance of AppCheck for FirebaseApp.defaultApp(). @throw Throws an exception if the default app is not configured yet or required FirebaseApp options are missing.

  • Returns an instance of AppCheck for an application.

    Declaration

    Objective-C

    + (nullable instancetype)appCheckWithApp:(nonnull FIRApp *)firebaseApp;

    Parameters

    firebaseApp

    A configured FirebaseApp instance if exists.

    Return Value

    An instance of AppCheck corresponding to the passed application. @throw Throws an exception if required FirebaseApp options are missing.

  • Sets the AppCheckProviderFactory to use to generate AppCheckDebugProvider objects.

    An instance of DeviceCheckProviderFactory is used by default, but you can also use a custom AppCheckProviderFactory implementation or an instance of AppCheckDebugProviderFactory to test your app on a simulator on a local machine or a build server.

    NOTE: Make sure to call this method before FirebaseApp.configure(). If this method is called after configuring Firebase, the changes will not take effect.

    Declaration

    Objective-C

    + (void)setAppCheckProviderFactory:
        (nullable id<FIRAppCheckProviderFactory>)factory;
  • If this flag is disabled then Firebase app check will not periodically auto-refresh the app check token. The default value of the flag is equal to FirebaseApp.dataCollectionDefaultEnabled. To disable the flag by default set FirebaseAppCheckTokenAutoRefreshEnabled flag in the app Info.plist to NO. Once the flag is set explicitly, the value will be persisted and used as a default value on next app launches.

    Declaration

    Objective-C

    @property (nonatomic) BOOL isTokenAutoRefreshEnabled;
  • 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.

    If your non-Firebase backend exposes sensitive or expensive endpoints that have low traffic volume, consider protecting it with Replay Protection. In this case, use the limitedUseToken(completion:) instead to obtain a limited-use token.

    Declaration

    Objective-C

    - (void)tokenForcingRefresh:(BOOL)forcingRefresh
                     completion:(nonnull void (^)(FIRAppCheckToken *_Nullable,
                                                  NSError *_Nullable))handler;

    Parameters

    forcingRefresh

    If YES, a new Firebase app check token is requested and the token cache is ignored. If NO, the cached token is used if it exists and has not expired yet. In most cases, NO should be used. YES should only be used if the server explicitly returns an error, indicating a revoked token.

    handler

    The completion handler. Includes the app check token if the request succeeds, or an error if the request fails.

  • Requests a limited-use 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. This method does not affect the token generation behavior of the tokenForcingRefresh() method.

    Declaration

    Objective-C

    - (void)limitedUseTokenWithCompletion:
        (nonnull void (^)(FIRAppCheckToken *_Nullable, NSError *_Nullable))handler;