exchangeDebugToken method

Validates a debug token secret that you have previously created using CreateDebugToken.

If valid, returns an App Check token encapsulated in an AttestationTokenResponse. Note that a restrictive quota is enforced on this method to prevent accidental exposure of the app to abuse.

request - The metadata request object.

Request parameters:

app - Required. The relative resource name of the app, in the format: projects/{project_number}/apps/{app_id} 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/\[^/\]+/apps/\[^/\]+$.

$fields - Selector specifying which fields to include in a partial response.

Completes with a GoogleFirebaseAppcheckV1betaAttestationTokenResponse.

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<GoogleFirebaseAppcheckV1betaAttestationTokenResponse>
    exchangeDebugToken(
  GoogleFirebaseAppcheckV1betaExchangeDebugTokenRequest request,
  core.String app, {
  core.String? $fields,
}) async {
  final _body = convert.json.encode(request.toJson());
  final _queryParams = <core.String, core.List<core.String>>{
    if ($fields != null) 'fields': [$fields],
  };

  final _url =
      'v1beta/' + core.Uri.encodeFull('$app') + ':exchangeDebugToken';

  final _response = await _requester.request(
    _url,
    'POST',
    body: _body,
    queryParams: _queryParams,
  );
  return GoogleFirebaseAppcheckV1betaAttestationTokenResponse.fromJson(
      _response as core.Map<core.String, core.dynamic>);
}