FirebaseAppCheck Framework Reference

FIRAppCheck

@interfaceFIRAppCheck:NSObject

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

  • Unavailable

    Undocumented

    Declaration

    Objective-C

    -(instancetype)initNS_UNAVAILABLE;
  • Returns a default instance ofAppCheck.

    Declaration

    Objective-C

    +(nonnullinstancetype)appCheck;

    Return Value

    An instance ofAppCheck forFirebaseApp.defaultApp().@throw Throws an exception if the default app is not configured yet or requiredFirebaseAppoptions are missing.

  • Returns an instance ofAppCheck for an application.

    Declaration

    Objective-C

    +(nullableinstancetype)appCheckWithApp:(nonnullFIRApp*)firebaseApp;

    Parameters

    firebaseApp

    A configuredFirebaseApp instance if exists.

    Return Value

    An instance ofAppCheck corresponding to the passed application.@throw Throws an exception if requiredFirebaseApp options are missing.

  • Sets theAppCheckProviderFactory to use to generateAppCheckDebugProvider objects.

    An instance ofDeviceCheckProviderFactory is used by default, but you canalso use a customAppCheckProviderFactory implementation or aninstance ofAppCheckDebugProviderFactory to test your app on a simulatoron a local machine or a build server.

    NOTE: Make sure to call this method beforeFirebaseApp.configure(). Ifthis method is called after configuring Firebase, the changes will not takeeffect.

    Declaration

    Objective-C

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

    Declaration

    Objective-C

    @property(nonatomic)BOOLisTokenAutoRefreshEnabled;
  • Requests Firebase app check token. This method shouldonly be used if you need to authorizerequests to a non-Firebase backend. Requests to Firebase backend are authorized automatically ifconfigured.

    If your non-Firebase backend exposes sensitive or expensive endpoints that have low trafficvolume, consider protecting it withReplayProtection.In this case, use thelimitedUseToken(completion:) instead to obtain a limited-use token.

    Declaration

    Objective-C

    -(void)tokenForcingRefresh:(BOOL)forcingRefreshcompletion:(nonnullvoid(^)(FIRAppCheckToken*_Nullable,NSError*_Nullable))handler;

    Parameters

    forcingRefresh

    IfYES, a new Firebase app check token is requested and the tokencache is ignored. IfNO, the cached token is used if it exists and has not expired yet. Inmost cases,NO should be used.YES should only be used if the server explicitly returns anerror, 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 toauthorize requests to a non-Firebase backend.

    Returns limited-use tokens that are intended for use with your non-Firebase backend endpointsthat are protected withReplayProtection.This method does not affect the token generation behavior of thetokenForcingRefresh() method.

    Declaration

    Objective-C

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

Except 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 2025-03-11 UTC.