firebase::app_check::AppCheck

#include <app_check.h>

Firebase App Check object.

Summary

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

With App Check, devices running your app will use an AppCheckProvider 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 an AppCheckListener to changes in the token state.
GetAppCheckToken(bool force_refresh)
Requests a Firebase App Check token.
GetAppCheckTokenLastResult()
Returns the result of the most recent call to GetAppCheckToken();.
RemoveAppCheckListener(AppCheckListener *listener)
void
Unregisters an AppCheckListener to changes in the token state.
SetTokenAutoRefreshEnabled(bool is_token_auto_refresh_enabled)
void
Sets the isTokenAutoRefreshEnabled flag.
app()
Get the firebase::App that this AppCheck was created with.

Public static functions

GetInstance(::firebase::App *app)
Gets the instance of AppCheck associated with the given App instance.
SetAppCheckProviderFactory(AppCheckProviderFactory *factory)
void
Installs the given AppCheckProviderFactory, overwriting any that were previously associated with this AppCheck instance.

Public functions

AddAppCheckListener

void AddAppCheckListener(
  AppCheckListener *listener
)

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

Future< AppCheckToken > GetAppCheckToken(
  bool force_refresh
)

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.

GetAppCheckTokenLastResult

Future< AppCheckToken > GetAppCheckTokenLastResult()

Returns the result of the most recent call to GetAppCheckToken();.

RemoveAppCheckListener

void RemoveAppCheckListener(
  AppCheckListener *listener
)

Unregisters an AppCheckListener to changes in the token state.

SetTokenAutoRefreshEnabled

void SetTokenAutoRefreshEnabled(
  bool is_token_auto_refresh_enabled
)

Sets the isTokenAutoRefreshEnabled flag.

app

::firebase::App * app()

Get the firebase::App that this AppCheck was created with.

Details
Returns
The firebase::App this AppCheck was created with.

~AppCheck

 ~AppCheck()

Destructor.

You may delete an instance of AppCheck when you are finished using it to shut down the AppCheck library.

Public static functions

GetInstance

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

Gets the instance of AppCheck associated with the given App instance.

SetAppCheckProviderFactory

void SetAppCheckProviderFactory(
  AppCheckProviderFactory *factory
)

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

Any AppCheckTokenListeners attached to this AppCheck 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, call setTokenAutoRefreshEnabled(bool) after installing the factory.

This method should be called before initializing the Firebase App.