SIGN IN SIGN UP

Welcome to the AWS Code Examples Repository. This repo contains code examples used in the AWS documentation, AWS SDK Developer Guides, and more. For more information, see the Readme.md file below.

0 0 238 Java
2022-02-11 13:00:54 +00:00
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
/*
2022-02-15 12:55:27 +00:00
ABOUT THIS NODE.JS EXAMPLE: This example works with the AWS SDK for JavaScript version 2 (v2).
2022-02-11 13:00:54 +00:00
Purpose:
2022-02-15 12:55:27 +00:00
admin-enable-user.js demonstrates how an administrator can enable a user in Amazon Cognito.
2022-02-11 13:00:54 +00:00
Inputs:
- USERPOOLID
- EMAIL
*/
// snippet-start:[cognito.JavaScript.admin-enable-user-v2]
const aws = require("aws-sdk");
/*Initializing CognitoIdentityServiceProvider from AWS SDK JS*/
const cognito = new AWS.CognitoIdentityServiceProvider({
apiVersion: "2016-04-18",
});
const USERPOOLID = "your Cognito User Pool ID";
exports.handler = async (event, context) => {
const EMAIL = event.email;
const cognitoParams = {
UserPoolId: USERPOOLID,
Username: EMAIL,
};
let response = await cognito.adminEnableUser(cognitoParams).promise();
console.log(JSON.stringify(response, null, 2));
};
// snippet-end:[cognito.JavaScript.admin-enable-user-v2]