getAccessToken method

Future<GetAccessTokenResponse> getAccessToken({
  1. required String token,
  2. List<String>? tokenProperties,
})

Gets a temporary access token to use with AssumeRoleWithWebIdentity. Access tokens are valid for one hour.

May throw AccessDeniedException. May throw AuthorizationException. May throw RateLimitExceededException. May throw ServerInternalException. May throw ValidationException.

Parameter token : Refresh token, encoded as a JWT token.

Parameter tokenProperties : Token properties to validate against those present in the JWT token.

Implementation

Future<GetAccessTokenResponse> getAccessToken({
  required String token,
  List<String>? tokenProperties,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSLicenseManager.GetAccessToken'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Token': token,
      if (tokenProperties != null) 'TokenProperties': tokenProperties,
    },
  );

  return GetAccessTokenResponse.fromJson(jsonResponse.body);
}