firebase::app_check::AppCheck

#include <app_check.h>

FirebaseApp Check object.

Summary

App Check helps protect your API resources from abuse by preventing unauthorized clients from accessing your backend resources.

WithApp Check, devices running your app will use anAppCheckProvider that attests to one or both of the following:

  • Requests originate from your authentic app
  • Requests originate from an authentic, untampered device

Constructors and Destructors

~AppCheck()
Destructor.

Public functions

AddAppCheckListener(AppCheckListener *listener)
void
Registers anAppCheckListener to changes in the token state.
GetAppCheckToken(bool force_refresh)
Requests a FirebaseApp Check token.
GetAppCheckTokenLastResult()
Returns the result of the most recent call toGetAppCheckToken();.
RemoveAppCheckListener(AppCheckListener *listener)
void
Unregisters anAppCheckListener to changes in the token state.
SetTokenAutoRefreshEnabled(bool is_token_auto_refresh_enabled)
void
Sets the isTokenAutoRefreshEnabled flag.
app()
Get thefirebase::App that thisAppCheck was created with.

Public static functions

GetInstance(::firebase::App *app)
Gets the instance ofAppCheck associated with the givenApp instance.
SetAppCheckProviderFactory(AppCheckProviderFactory *factory)
void
Installs the givenAppCheckProviderFactory, overwriting any that were previously associated with thisAppCheck instance.

Public functions

AddAppCheckListener

voidAddAppCheckListener(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

Future<AppCheckToken>GetAppCheckToken(boolforce_refresh)

Requests a FirebaseApp 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.

GetAppCheckTokenLastResult

Future<AppCheckToken>GetAppCheckTokenLastResult()

Returns the result of the most recent call toGetAppCheckToken();.

RemoveAppCheckListener

voidRemoveAppCheckListener(AppCheckListener*listener)

Unregisters anAppCheckListener to changes in the token state.

SetTokenAutoRefreshEnabled

voidSetTokenAutoRefreshEnabled(boolis_token_auto_refresh_enabled)

Sets the isTokenAutoRefreshEnabled flag.

app

::firebase::App*app()

Get thefirebase::App that thisAppCheck was created with.

Details
Returns
Thefirebase::App thisAppCheck was created with.

~AppCheck

~AppCheck()

Destructor.

You may delete an instance ofAppCheck when you are finished using it to shut down theAppCheck library.

Public static functions

GetInstance

AppCheck*GetInstance(::firebase::App*app)

Gets the instance ofAppCheck associated with the givenApp instance.

SetAppCheckProviderFactory

voidSetAppCheckProviderFactory(AppCheckProviderFactory*factory)

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

Any AppCheckTokenListeners attached to thisAppCheck 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 FirebaseApp Check without changing the isDataCollectionDefaultEnabled flag for other Firebase SDKs, call setTokenAutoRefreshEnabled(bool) after installing the factory.

This method should be called before initializing the FirebaseApp.

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 2024-01-23 UTC.