FirebaseAppCheck

abstract class FirebaseAppCheck : InteropAppCheckTokenProvider


Summary

Nested types

Public constructors

Public functions

abstract Unit

Registers an AppCheckListener to changes in the token state.

abstract Task<AppCheckToken!>
getAppCheckToken(forceRefresh: Boolean)

Requests a Firebase App Check token.

java-static FirebaseAppCheck

Gets the default instance of FirebaseAppCheck.

java-static FirebaseAppCheck
getInstance(firebaseApp: FirebaseApp)

Gets the instance of FirebaseAppCheck associated with the given FirebaseApp instance.

abstract Task<AppCheckToken!>

Requests a Firebase App Check token.

abstract Unit

Installs the given AppCheckProviderFactory, overwriting any that were previously associated with this FirebaseAppCheck instance.

abstract Unit
installAppCheckProviderFactory(
    factory: AppCheckProviderFactory,
    isTokenAutoRefreshEnabled: Boolean
)

Installs the given AppCheckProviderFactory, overwriting any that were previously associated with this FirebaseAppCheck instance.

abstract Unit

Unregisters an AppCheckListener to changes in the token state.

abstract Unit
setTokenAutoRefreshEnabled(isTokenAutoRefreshEnabled: Boolean)

Sets the isTokenAutoRefreshEnabled flag.

Public constructors

FirebaseAppCheck

FirebaseAppCheck()

Public functions

addAppCheckListener

abstract fun addAppCheckListener(listener: FirebaseAppCheck.AppCheckListener): Unit

Registers an AppCheckListener to changes in the token state. This method should be used ONLY if you need to authorize requests to a non-Firebase backend. Requests to Firebase backends are authorized automatically if configured.

getAppCheckToken

abstract fun getAppCheckToken(forceRefresh: Boolean): Task<AppCheckToken!>

Requests a Firebase App Check token. This method should be used ONLY if you need to authorize requests to a non-Firebase backend. Requests to Firebase backends are authorized automatically if configured.

If your non-Firebase backend exposes a sensitive or expensive endpoint that has low traffic volume, consider protecting it with Replay Protection. In this case, use getLimitedUseAppCheckToken instead to obtain a limited-use token.

getInstance

java-static fun getInstance(): FirebaseAppCheck

Gets the default instance of FirebaseAppCheck.

getInstance

java-static fun getInstance(firebaseApp: FirebaseApp): FirebaseAppCheck

Gets the instance of FirebaseAppCheck associated with the given FirebaseApp instance.

getLimitedUseAppCheckToken

abstract fun getLimitedUseAppCheckToken(): Task<AppCheckToken!>

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. This method does not affect the token generation behavior of the getAppCheckToken method.

installAppCheckProviderFactory

abstract fun installAppCheckProviderFactory(factory: AppCheckProviderFactory): Unit

Installs the given AppCheckProviderFactory, overwriting any that were previously associated with this FirebaseAppCheck instance. Any AppCheckTokenListeners attached to this FirebaseAppCheck instance will be transferred from existing factories to the newly installed one.

Automatic token refreshing will only occur if the global isDataCollectionDefaultEnabled flag is set to true. To allow automatic token refreshing for Firebase App Check without changing the isDataCollectionDefaultEnabled flag for other Firebase SDKs, use installAppCheckProviderFactory instead or call setTokenAutoRefreshEnabled after installing the factory.

installAppCheckProviderFactory

abstract fun installAppCheckProviderFactory(
    factory: AppCheckProviderFactory,
    isTokenAutoRefreshEnabled: Boolean
): Unit

Installs the given AppCheckProviderFactory, overwriting any that were previously associated with this FirebaseAppCheck instance. Any AppCheckTokenListeners attached to this FirebaseAppCheck instance will be transferred from existing factories to the newly installed one.

Automatic token refreshing will only occur if the isTokenAutoRefreshEnabled field is set to true. To use the global isDataCollectionDefaultEnabled flag for determining automatic token refreshing, call installAppCheckProviderFactory instead.

removeAppCheckListener

abstract fun removeAppCheckListener(listener: FirebaseAppCheck.AppCheckListener): Unit

Unregisters an AppCheckListener to changes in the token state.

setTokenAutoRefreshEnabled

abstract fun setTokenAutoRefreshEnabled(isTokenAutoRefreshEnabled: Boolean): Unit

Sets the isTokenAutoRefreshEnabled flag.