addUserPoolClientSecret method
Creates a new client secret for an existing confidential user pool app client. Supports up to 2 active secrets per app client for zero-downtime credential rotation workflows.
May throw AccessDeniedException.
May throw InternalServerException.
May throw InvalidParameterException.
May throw LimitExceededException.
May throw ResourceNotFoundException.
May throw TooManyRequestsException.
Parameter clientId :
The ID of the app client for which you want to create a new secret.
Parameter userPoolId :
The ID of the user pool that contains the app client.
Parameter clientSecret :
The client secret value you want to use. If you don't provide this
parameter, Amazon Cognito generates a secure secret for you.
Implementation
Future<AddUserPoolClientSecretResponse> addUserPoolClientSecret({
required String clientId,
required String userPoolId,
String? clientSecret,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target':
'AWSCognitoIdentityProviderService.AddUserPoolClientSecret'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'ClientId': clientId,
'UserPoolId': userPoolId,
if (clientSecret != null) 'ClientSecret': clientSecret,
},
);
return AddUserPoolClientSecretResponse.fromJson(jsonResponse.body);
}