startDeviceAuthorization method

Future<StartDeviceAuthorizationResponse> startDeviceAuthorization({
  1. required String clientId,
  2. required String clientSecret,
  3. required String startUrl,
})

Initiates device authorization by requesting a pair of verification codes from the authorization service.

May throw InvalidRequestException. May throw InvalidClientException. May throw UnauthorizedClientException. May throw SlowDownException. May throw InternalServerException.

Parameter clientId : The unique identifier string for the client that is registered with AWS SSO. This value should come from the persisted result of the RegisterClient API operation.

Parameter clientSecret : A secret string that is generated for the client. This value should come from the persisted result of the RegisterClient API operation.

Parameter startUrl : The URL for the AWS SSO user portal. For more information, see Using the User Portal in the AWS Single Sign-On User Guide.

Implementation

Future<StartDeviceAuthorizationResponse> startDeviceAuthorization({
  required String clientId,
  required String clientSecret,
  required String startUrl,
}) async {
  ArgumentError.checkNotNull(clientId, 'clientId');
  ArgumentError.checkNotNull(clientSecret, 'clientSecret');
  ArgumentError.checkNotNull(startUrl, 'startUrl');
  final $payload = <String, dynamic>{
    'clientId': clientId,
    'clientSecret': clientSecret,
    'startUrl': startUrl,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/device_authorization',
    signed: false,
    exceptionFnMap: _exceptionFns,
  );
  return StartDeviceAuthorizationResponse.fromJson(response);
}