verifyAppCheckToken method
- GoogleFirebaseAppcheckV1betaVerifyAppCheckTokenRequest request,
- String project, {
- String? $fields,
Verifies the given App Check token and returns token usage signals that callers may act upon.
This method currently only supports App Check tokens exchanged from the
following attestation providers: * Play Integrity API * App Attest *
DeviceCheck (DCDevice
tokens) * reCAPTCHA Enterprise * reCAPTCHA v3 *
Custom providers App Check tokens exchanged from debug secrets are also
supported. Calling this method on an otherwise valid App Check token with
an unsupported provider will cause an HTTP 400 error to be returned.
Returns whether this token was already consumed before this call. If this
is the first time this method has seen the given App Check token, the
field already_consumed
in the response will be absent. The given token
will then be marked as already_consumed
(set to true
) for all future
invocations of this method for that token. Note that if the given App
Check token is invalid, an HTTP 403 error is returned instead of a
response object, regardless whether the token was already consumed.
Currently, when evaluating whether an App Check token was already
consumed, only calls to this exact method are counted. Use of the App
Check token elsewhere will not mark the token as being already consumed.
The caller must have the
[firebaseappcheck.appCheckTokens.verify
](https://firebase.google.com/docs/projects/iam/permissions#app-check)
permission to call this method. This permission is part of the
Firebase App Check Token Verifier role.
request
- The metadata request object.
Request parameters:
project
- Required. The relative resource name of the project for which
the token was minted, in the format: projects/{project_number}
If
necessary, the project_number
element can be replaced with the project
ID of the Firebase project. Learn more about using project identifiers in
Google's AIP 2510 standard.
Value must have pattern ^projects/\[^/\]+$
.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a GoogleFirebaseAppcheckV1betaVerifyAppCheckTokenResponse.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client
completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<GoogleFirebaseAppcheckV1betaVerifyAppCheckTokenResponse>
verifyAppCheckToken(
GoogleFirebaseAppcheckV1betaVerifyAppCheckTokenRequest request,
core.String project, {
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if ($fields != null) 'fields': [$fields],
};
final url_ =
'v1beta/' + core.Uri.encodeFull('$project') + ':verifyAppCheckToken';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return GoogleFirebaseAppcheckV1betaVerifyAppCheckTokenResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}