async function updateCognitoAppCallbacks()

in amplify/backend/function/amplifyIdentityBrokerPostDeployment/src/index.js [51:78]


async function updateCognitoAppCallbacks(AppClientId, UserPoolId, domainUrl) {
	console.log(
		`Updating UserPool ${UserPoolId} app client ${AppClientId} with callbacks ${domainUrl}`
	);

	var params = {
		ClientId: AppClientId,
		UserPoolId: UserPoolId,
	};
	var description = await cognitoidentityserviceprovider
		.describeUserPoolClient(params)
		.promise();

	console.log(description);

	// Remove field that are not inputs
	delete description.UserPoolClient.ClientSecret;
	delete description.UserPoolClient.LastModifiedDate;
	delete description.UserPoolClient.CreationDate;

	params = description.UserPoolClient;
	params.CallbackURLs = new Array();
	params.CallbackURLs.push(domainUrl);
	params.LogoutURLs = new Array();
	params.LogoutURLs.push(domainUrl + "/logout");

	return cognitoidentityserviceprovider.updateUserPoolClient(params).promise();
}