completeAuthenticate method

  1. @override
Future<CorbadoTokens> completeAuthenticate(
  1. AuthenticationCompleteRequest request
)
override

Completes the authentication by sending the solution to the challenge back.

Implementation

@override
Future<CorbadoTokens> completeAuthenticate(
  AuthenticationCompleteRequest request,
) async {
  try {
    final signedChallenge = jsonEncode(
      CorbadoAuthenticationCompleteRequest.fromAuthenticationCompleteRequest(
        request,
      ).toJson(),
    );

    final response = await UsersApi(_client).passKeyLoginFinish(
      PassKeyFinishReq(signedChallenge: signedChallenge),
    );

    return CorbadoTokens.fromPassKeyLoginFinishRsp(response!);
  } on ApiException catch (e) {
    throw ExceptionFactory.fromBackendMessage(
      'passKeyAuthenticateFinish',
      e.message ?? '',
    );
  }
}