AppCheck
class AppCheck : NSObjectA class used to manage app check tokens for a given Firebase app.
-
Unavailable
Undocumented
-
Returns a default instance of
AppCheck.Declaration
Swift
class func appCheck() -> SelfReturn Value
An instance of
AppCheckforFirebaseApp.defaultApp(). @throw Throws an exception if the default app is not configured yet or requiredFirebaseAppoptions are missing. -
Returns an instance of
AppCheckfor an application.Declaration
Swift
class func appCheck(app firebaseApp: FIRApp) -> Self?Parameters
firebaseAppA configured
FirebaseAppinstance if exists.Return Value
An instance of
AppCheckcorresponding to the passed application. @throw Throws an exception if requiredFirebaseAppoptions are missing. -
Sets the
AppCheckProviderFactoryto use to generateAppCheckDebugProviderobjects.An instance of
DeviceCheckProviderFactoryis used by default, but you can also use a customAppCheckProviderFactoryimplementation or an instance ofAppCheckDebugProviderFactoryto 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
Swift
class func setAppCheckProviderFactory(_ factory: (any FIRAppCheckProviderFactory)?) -
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 setFirebaseAppCheckTokenAutoRefreshEnabledflag in the app Info.plist toNO. Once the flag is set explicitly, the value will be persisted and used as a default value on next app launches.Declaration
Swift
var isTokenAutoRefreshEnabled: Bool { get set } -
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
Swift
func token(forcingRefresh: Bool) async throws -> FIRAppCheckTokenParameters
forcingRefreshIf
YES, a new Firebase app check token is requested and the token cache is ignored. IfNO, the cached token is used if it exists and has not expired yet. In most cases,NOshould be used.YESshould only be used if the server explicitly returns an error, indicating a revoked token.handlerThe 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
Swift
func limitedUseToken() async throws -> FIRAppCheckToken