getAccessToken method

Future<Result<IamToken, Exception>> getAccessToken()

Implementation

Future<Result<IamToken, Exception>> getAccessToken() async {
  final result = await _flutterAuthApi.getCurrentToken(_appName);

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

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

  final iamToken = ModelUtils.createTokenFromPigeon(pigeonIamToken);
  return Result.success(iamToken);
}