VerifyAppCheckTokenOptions.Builder

public static final class VerifyAppCheckTokenOptions.Builder extends Object

Public Method Summary

VerifyAppCheckTokenOptions
build()
Builds a new VerifyAppCheckTokenOptions instance.
VerifyAppCheckTokenOptions.Builder
setConsume(boolean consume)
To use the replay protection feature, set this to true.
VerifyAppCheckTokenOptions.Builder
setConsume(Optional<Boolean> consume)
Sets whether to consume the token during verification.

Inherited Method Summary

Public Methods

public VerifyAppCheckTokenOptions build ()

Builds a new VerifyAppCheckTokenOptions instance.

public VerifyAppCheckTokenOptions.Builder setConsume (boolean consume)

To use the replay protection feature, set this to true. The FirebaseAppCheck.verifyToken(String) method will mark the token as consumed after verifying it.

Tokens that are found to be already consumed will not throw an exception. Instead, VerifyAppCheckTokenResponse.isAlreadyConsumed() returns Optional.of(true) in the response.

Tokens are only considered to be consumed if they are sent to the App Check backend by calling FirebaseAppCheck.verifyToken(String) with this option set to true; other uses of the token do not consume it.

This replay protection feature requires an additional network call to the App Check backend and forces your clients to obtain a fresh attestation from your chosen attestation providers. This can therefore negatively impact performance and can potentially deplete your attestation providers' quotas faster. We recommend that you use this feature only for protecting low-volume, security-critical, or expensive operations.

Parameters
consume Set to true to consume the token.
Returns
  • This builder.

public VerifyAppCheckTokenOptions.Builder setConsume (Optional<Boolean> consume)

Sets whether to consume the token during verification. See setConsume(boolean) for details about the replay protection feature.

Parameters
consume Optional boolean value. Must not be null.
Returns
  • This builder.