listDevices method
Lists the devices that Amazon Cognito has registered to the currently signed-in user. For more information about device authentication, see Working with user devices in your user pool.
Authorize this action with a signed-in user's access token. It must
include the scope aws.cognito.signin.user.admin.
May throw ForbiddenException.
May throw InternalErrorException.
May throw InvalidParameterException.
May throw InvalidUserPoolConfigurationException.
May throw NotAuthorizedException.
May throw OperationNotEnabledException.
May throw PasswordResetRequiredException.
May throw ResourceNotFoundException.
May throw TooManyRequestsException.
May throw UserNotConfirmedException.
May throw UserNotFoundException.
Parameter accessToken :
A valid access token that Amazon Cognito issued to the currently signed-in
user. Must include a scope claim for
aws.cognito.signin.user.admin.
Parameter limit :
The maximum number of devices that you want Amazon Cognito to return in
the response.
Parameter paginationToken :
This API operation returns a limited number of results. The pagination
token is an identifier that you can present in an additional API request
with the same parameters. When you include the pagination token, Amazon
Cognito returns the next set of items after the current list. Subsequent
requests return a new pagination token. By use of this token, you can
paginate through the full list of items.
Implementation
Future<ListDevicesResponse> listDevices({
required String accessToken,
int? limit,
String? paginationToken,
}) async {
_s.validateNumRange(
'limit',
limit,
0,
60,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSCognitoIdentityProviderService.ListDevices'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
signed: false,
// TODO queryParams
headers: headers,
payload: {
'AccessToken': accessToken,
if (limit != null) 'Limit': limit,
if (paginationToken != null) 'PaginationToken': paginationToken,
},
);
return ListDevicesResponse.fromJson(jsonResponse.body);
}