updateUserPoolDomain method
A user pool domain hosts managed login, an authorization server and web
server for authentication in your application. This operation updates the
branding version for user pool domains between 1 for hosted
UI (classic) and 2 for managed login. It also updates the SSL
certificate for user pool custom domains.
Changes to the domain branding version take up to one minute to take effect for a prefix domain and up to five minutes for a custom domain.
This operation doesn't change the name of your user pool domain. To change
your domain, delete it with DeleteUserPoolDomain and create a
new domain with CreateUserPoolDomain.
You can pass the ARN of a new Certificate Manager certificate in this request. Typically, ACM certificates automatically renew and you user pool can continue to use the same ARN. But if you generate a new certificate for your custom domain name, replace the original configuration with the new ARN in this request.
ACM certificates for custom domains must be in the US East (N. Virginia) Amazon Web Services Region. After you submit your request, Amazon Cognito requires up to 1 hour to distribute your new certificate to your custom domain.
For more information about adding a custom domain to your user pool, see Configuring a user pool domain.
Learn more
- Signing Amazon Web Services API Requests
- Using the Amazon Cognito user pools API and user pool endpoints
May throw ConcurrentModificationException.
May throw FeatureUnavailableInTierException.
May throw InternalErrorException.
May throw InvalidParameterException.
May throw NotAuthorizedException.
May throw OperationNotEnabledException.
May throw ResourceNotFoundException.
May throw TooManyRequestsException.
Parameter domain :
The name of the domain that you want to update. For custom domains, this
is the fully-qualified domain name, for example
auth.example.com. For prefix domains, this is the prefix
alone, such as myprefix.
Parameter userPoolId :
The ID of the user pool that is associated with the domain you're
updating.
Parameter customDomainConfig :
The configuration for a custom domain that hosts managed login for your
application. In an UpdateUserPoolDomain request, this
parameter specifies an SSL certificate for the managed login hosted
webserver. The certificate must be an ACM ARN in us-east-1.
When you create a custom domain, the passkey RP ID defaults to the custom domain. If you had a prefix domain active, this will cause passkey integration for your prefix domain to stop working due to a mismatch in RP ID. To keep the prefix domain passkey integration working, you can explicitly set RP ID to the prefix domain.
Parameter managedLoginVersion :
A version number that indicates the state of managed login for your
domain. Version 1 is hosted UI (classic). Version
2 is the newer managed login with the branding editor. For
more information, see Managed
login.
Parameter routing :
The routing configuration for the user pool domain. Specifies failover
settings for multi-region deployments.
Implementation
Future<UpdateUserPoolDomainResponse> updateUserPoolDomain({
required String domain,
required String userPoolId,
CustomDomainConfigType? customDomainConfig,
int? managedLoginVersion,
RoutingType? routing,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSCognitoIdentityProviderService.UpdateUserPoolDomain'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'Domain': domain,
'UserPoolId': userPoolId,
if (customDomainConfig != null)
'CustomDomainConfig': customDomainConfig,
if (managedLoginVersion != null)
'ManagedLoginVersion': managedLoginVersion,
if (routing != null) 'Routing': routing,
},
);
return UpdateUserPoolDomainResponse.fromJson(jsonResponse.body);
}