exchangeToken method

Future<Result<IdToken, Exception>> exchangeToken(
  1. String iamAudience
)

Implementation

Future<Result<IdToken, Exception>> exchangeToken(String iamAudience) async {
  final result = await _flutterAuthApi.exchangeToken(_appName, iamAudience);

  if (result.isSuccess != true) {
    return Result.failure(Exception(result.error));
  }
  final pigeonIdToken = result.idToken;

  if (pigeonIdToken == null) {
    return Result.failure(Exception("Missing data exception"));
  }

  final idToken = ModelUtils.createIdTokenFromPigeon(pigeonIdToken);
  return Result.success(idToken);
}