FirebaseAppCheck

public abstract classFirebaseAppCheck implementsInteropAppCheckTokenProvider


Summary

Nested types

Public constructors

Public methods

abstract void

Registers anAppCheckListener to changes in the token state.

abstract @NonNullTask<AppCheckToken>
getAppCheckToken(boolean forceRefresh)

Requests a Firebase App Check token.

static @NonNullFirebaseAppCheck

Gets the default instance ofFirebaseAppCheck.

static @NonNullFirebaseAppCheck

Gets the instance ofFirebaseAppCheck associated with the givenFirebaseApp instance.

abstract @NonNullTask<AppCheckToken>

Requests a Firebase App Check token.

abstract void

Installs the givenAppCheckProviderFactory, overwriting any that were previously associated with thisFirebaseAppCheck instance.

abstract void
installAppCheckProviderFactory(
    @NonNullAppCheckProviderFactory factory,
    boolean isTokenAutoRefreshEnabled
)

Installs the givenAppCheckProviderFactory, overwriting any that were previously associated with thisFirebaseAppCheck instance.

abstract void

Unregisters anAppCheckListener to changes in the token state.

abstract void
setTokenAutoRefreshEnabled(boolean isTokenAutoRefreshEnabled)

Sets theisTokenAutoRefreshEnabled flag.

Public constructors

FirebaseAppCheck

public FirebaseAppCheck()

Public methods

addAppCheckListener

public abstract void addAppCheckListener(@NonNullFirebaseAppCheck.AppCheckListener listener)

Registers anAppCheckListener 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

public abstract @NonNullTask<AppCheckTokengetAppCheckToken(boolean forceRefresh)

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 withReplay Protection. In this case, usegetLimitedUseAppCheckToken instead to obtain a limited-use token.

getInstance

public static @NonNullFirebaseAppCheck getInstance()

Gets the default instance ofFirebaseAppCheck.

getInstance

public static @NonNullFirebaseAppCheck getInstance(@NonNullFirebaseApp firebaseApp)

Gets the instance ofFirebaseAppCheck associated with the givenFirebaseApp instance.

getLimitedUseAppCheckToken

public abstract @NonNullTask<AppCheckTokengetLimitedUseAppCheckToken()

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

installAppCheckProviderFactory

public abstract void installAppCheckProviderFactory(@NonNullAppCheckProviderFactory factory)

Installs the givenAppCheckProviderFactory, overwriting any that were previously associated with thisFirebaseAppCheck instance. AnyAppCheckTokenListeners attached to thisFirebaseAppCheck instance will be transferred from existing factories to the newly installed one.

Automatic token refreshing will only occur if the globalisDataCollectionDefaultEnabled flag is set to true. To allow automatic token refreshing for Firebase App Check without changing theisDataCollectionDefaultEnabled flag for other Firebase SDKs, useinstallAppCheckProviderFactory instead or callsetTokenAutoRefreshEnabled after installing thefactory.

installAppCheckProviderFactory

public abstract void installAppCheckProviderFactory(
    @NonNullAppCheckProviderFactory factory,
    boolean isTokenAutoRefreshEnabled
)

Installs the givenAppCheckProviderFactory, overwriting any that were previously associated with thisFirebaseAppCheck instance. AnyAppCheckTokenListeners attached to thisFirebaseAppCheck instance will be transferred from existing factories to the newly installed one.

Automatic token refreshing will only occur if theisTokenAutoRefreshEnabled field is set to true. To use the globalisDataCollectionDefaultEnabled flag for determining automatic token refreshing, callinstallAppCheckProviderFactory instead.

removeAppCheckListener

public abstract void removeAppCheckListener(
    @NonNullFirebaseAppCheck.AppCheckListener listener
)

Unregisters anAppCheckListener to changes in the token state.

setTokenAutoRefreshEnabled

public abstract void setTokenAutoRefreshEnabled(boolean isTokenAutoRefreshEnabled)

Sets theisTokenAutoRefreshEnabled flag.

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-07-21 UTC.