Socket
Socket
Sign inDemoInstall

amazon-cognito-identity-js

Package Overview
Dependencies
Maintainers
13
Versions
1619
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amazon-cognito-identity-js - npm Package Compare versions

Comparing version 6.3.11 to 6.3.12

4

package.json
{
"name": "amazon-cognito-identity-js",
"description": "Amazon Cognito Identity Provider JavaScript SDK",
"version": "6.3.11",
"version": "6.3.12",
"author": {

@@ -77,3 +77,3 @@ "name": "Amazon Web Services",

},
"gitHead": "8bebe89eab5b8383f50ca50b993c193de554de01"
"gitHead": "7880ce75f8045578795a8b40839619e37a5b563b"
}

@@ -0,1 +1,35 @@

# Developer Note: Please Update to Amplify v6
We recommend using the Amplify JavaScript library's Auth features in place of the Amazon Cognito Identity SDK. The Amplify JavaScript library offers a modern, fully-typed, and performant experience for Auth use cases with tree-shaking built-in for bundle size reduction.
## Amazon Cognito Identity SDK and Amplify JavaScript API Mappings
The following table provides the Amplify Auth APIs that can be used to satisfy Amazon Cognito Identity SDK use cases.
| Amazon Cognito Identity SDK Use Case | Amplify JS Auth |
| --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| Registering a user with the application. | [Sign Up](https://docs.amplify.aws/react/build-a-backend/auth/enable-sign-up/#sign-up) |
| Confirming a registered, unauthenticated user using a confirmation code. | [Confirm Sign Up](https://docs.amplify.aws/react/build-a-backend/auth/enable-sign-up/#confirm-sign-up) |
| Resending a confirmation code for an unauthenticated user. | [Resend Sign Up Code](https://aws-amplify.github.io/amplify-js/api/functions/aws_amplify.auth.resendSignUpCode.html) |
| Authenticating a user and establishing a user session. | [Sign In](https://docs.amplify.aws/react/build-a-backend/auth/enable-sign-up/#sign-in) |
| Configuring an authentication flow type. | [Auth Flows](https://docs.amplify.aws/react/build-a-backend/auth/switch-auth/) |
| Configuring persistence of auth data. | [Token Saving Mechanism](https://docs.amplify.aws/react/build-a-backend/auth/manage-user-session/#update-your-token-saving-mechanism) |
| Handling token expiration. | [Token Expiration](https://docs.amplify.aws/react/build-a-backend/auth/manage-user-session/#refreshing-sessions) |
| Retrieving user attributes for an authenticated user. | [Fetch User Attributes](https://docs.amplify.aws/react/build-a-backend/auth/manage-user-profile/#retrieve-user-attributes) |
| Updating user attributes for an authenticated user. | [Update User Attributes](https://docs.amplify.aws/react/build-a-backend/auth/manage-user-profile/#update-user-attributes) |
| Verifying a user attribute for an authenticated user. | [Confirm User Attribute](https://docs.amplify.aws/react/build-a-backend/auth/manage-user-profile/#verify-user-attribute) |
| Sending a user attribute confirmation code for an authenticated user. | [Send User Attribute Code](https://docs.amplify.aws/react/build-a-backend/auth/manage-user-profile/#send-user-attribute-verification-code) |
| Deleting user attributes for an authenticated user. | [Delete User Attributes](https://docs.amplify.aws/react/build-a-backend/auth/manage-user-profile/#delete-user-attributes) |
| Updating MFA settings for a user on a User Pool that allows MFA. | [Update MFA Preference](https://docs.amplify.aws/react/build-a-backend/auth/manage-mfa/#update-the-current-users-mfa-preferences) |
| Getting MFA preferences for an authenticated user. | [Fetch MFA Preference](https://docs.amplify.aws/react/build-a-backend/auth/manage-mfa/#fetch-the-current-users-mfa-preferences) |
| Setting up TOTP MFA. | [TOTP Setup](https://docs.amplify.aws/react/build-a-backend/auth/manage-mfa/#set-up-totp-for-a-user) |
| Changing the current password for an authenticated user. | [Update Password](https://docs.amplify.aws/react/build-a-backend/auth/manage-passwords/#update-password) |
| Starting password recovery for an unauthenticated user. | [Reset Password](https://docs.amplify.aws/react/build-a-backend/auth/manage-passwords/#reset-password) |
| Deleting an authenticated user. | [Delete User](https://docs.amplify.aws/react/build-a-backend/auth/delete-user-account/) |
| Signing out from the application (including global sign out). | [Sign Out](https://docs.amplify.aws/react/build-a-backend/auth/enable-sign-up/#sign-out) |
| Retrieving the authenticated user's session information. | [Fetch Auth Session](https://docs.amplify.aws/react/build-a-backend/auth/manage-user-session/#retrieve-a-user-session) |
| Fetching all remembered devices for an authenticated user as a limited, paginated list. | [Fetch Devices](https://docs.amplify.aws/react/build-a-backend/auth/remember-device/#fetch-devices) |
| Remembering the current device. | [Remember Device](https://docs.amplify.aws/react/build-a-backend/auth/remember-device/#remember-device) |
| Forgetting a device. | [Forget Device](https://docs.amplify.aws/react/build-a-backend/auth/remember-device/#forget-device) |
# Amazon Cognito Identity SDK for JavaScript

@@ -222,13 +256,16 @@

userPool.signUp('username', 'password', attributeList, null, function(
err,
result
) {
if (err) {
alert(err.message || JSON.stringify(err));
return;
userPool.signUp(
'username',
'password',
attributeList,
null,
function (err, result) {
if (err) {
alert(err.message || JSON.stringify(err));
return;
}
var cognitoUser = result.user;
console.log('user name is ' + cognitoUser.getUsername());
}
var cognitoUser = result.user;
console.log('user name is ' + cognitoUser.getUsername());
});
);
```

@@ -251,3 +288,3 @@

var cognitoUser = new AmazonCognitoIdentity.CognitoUser(userData);
cognitoUser.confirmRegistration('123456', true, function(err, result) {
cognitoUser.confirmRegistration('123456', true, function (err, result) {
if (err) {

@@ -264,3 +301,3 @@ alert(err.message || JSON.stringify(err));

```javascript
cognitoUser.resendConfirmationCode(function(err, result) {
cognitoUser.resendConfirmationCode(function (err, result) {
if (err) {

@@ -297,3 +334,3 @@ alert(err.message || JSON.stringify(err));

cognitoUser.authenticateUser(authenticationDetails, {
onSuccess: function(result) {
onSuccess: function (result) {
var accessToken = result.getAccessToken().getJwtToken();

@@ -326,3 +363,3 @@

onFailure: function(err) {
onFailure: function (err) {
alert(err.message || JSON.stringify(err));

@@ -340,3 +377,3 @@ },

```javascript
cognitoUser.getUserAttributes(function(err, result) {
cognitoUser.getUserAttributes(function (err, result) {
if (err) {

@@ -360,9 +397,9 @@ alert(err.message || JSON.stringify(err));

cognitoUser.getAttributeVerificationCode('email', {
onSuccess: function(result) {
onSuccess: function (result) {
console.log('call result: ' + result);
},
onFailure: function(err) {
onFailure: function (err) {
alert(err.message || JSON.stringify(err));
},
inputVerificationCode: function() {
inputVerificationCode: function () {
var verificationCode = prompt('Please input verification code: ', '');

@@ -380,3 +417,3 @@ cognitoUser.verifyAttribute('email', verificationCode, this);

cognitoUser.deleteAttributes(attributeList, function(err, result) {
cognitoUser.deleteAttributes(attributeList, function (err, result) {
if (err) {

@@ -401,3 +438,3 @@ alert(err.message || JSON.stringify(err));

cognitoUser.updateAttributes(attributeList, function(err, result) {
cognitoUser.updateAttributes(attributeList, function (err, result) {
if (err) {

@@ -416,3 +453,3 @@ alert(err.message || JSON.stringify(err));

```javascript
cognitoUser.enableMFA(function(err, result) {
cognitoUser.enableMFA(function (err, result) {
if (err) {

@@ -431,3 +468,3 @@ alert(err.message || JSON.stringify(err));

```javascript
cognitoUser.disableMFA(function(err, result) {
cognitoUser.disableMFA(function (err, result) {
if (err) {

@@ -444,9 +481,13 @@ alert(err.message || JSON.stringify(err));

```javascript
cognitoUser.changePassword('oldPassword', 'newPassword', function(err, result) {
if (err) {
alert(err.message || JSON.stringify(err));
return;
cognitoUser.changePassword(
'oldPassword',
'newPassword',
function (err, result) {
if (err) {
alert(err.message || JSON.stringify(err));
return;
}
console.log('call result: ' + result);
}
console.log('call result: ' + result);
});
);
```

@@ -471,11 +512,11 @@

cognitoUser.forgotPassword({
onSuccess: function(data) {
onSuccess: function (data) {
// successfully initiated reset password request
console.log('CodeDeliveryData from forgotPassword: ' + data);
},
onFailure: function(err) {
onFailure: function (err) {
alert(err.message || JSON.stringify(err));
},
//Optional automatic callback
inputVerificationCode: function(data) {
inputVerificationCode: function (data) {
console.log('Code sent to: ' + data);

@@ -499,3 +540,3 @@ var verificationCode = document.getElementById('code').value;

```javascript
cognitoUser.deleteUser(function(err, result) {
cognitoUser.deleteUser(function (err, result) {
if (err) {

@@ -532,3 +573,3 @@ alert(err.message || JSON.stringify(err));

userPool.storage.sync(function(err, result) {
userPool.storage.sync(function (err, result) {
if (err) {

@@ -553,3 +594,3 @@ } else if (result === 'SUCCESS') {

if (cognitoUser != null) {
cognitoUser.getSession(function(err, session) {
cognitoUser.getSession(function (err, session) {
if (err) {

@@ -562,3 +603,3 @@ alert(err.message || JSON.stringify(err));

// NOTE: getSession must be called to authenticate user before calling getUserAttributes
cognitoUser.getUserAttributes(function(err, attributes) {
cognitoUser.getUserAttributes(function (err, attributes) {
if (err) {

@@ -593,3 +634,3 @@ // Handle error

if (cognitoUser != null) {
cognitoUser.getSession(function(err, result) {
cognitoUser.getSession(function (err, result) {
if (result) {

@@ -629,6 +670,6 @@ console.log('You are now logged in.');

cognitoUser.listDevices(limit, paginationToken, {
onSuccess: function(result) {
onSuccess: function (result) {
console.log('call result: ' + result);
},
onFailure: function(err) {
onFailure: function (err) {
alert(err.message);

@@ -643,6 +684,6 @@ },

cognitoUser.getDevice({
onSuccess: function(result) {
onSuccess: function (result) {
console.log('call result: ' + result);
},
onFailure: function(err) {
onFailure: function (err) {
alert(err.message || JSON.stringify(err));

@@ -657,6 +698,6 @@ },

cognitoUser.setDeviceStatusRemembered({
onSuccess: function(result) {
onSuccess: function (result) {
console.log('call result: ' + result);
},
onFailure: function(err) {
onFailure: function (err) {
alert(err.message || JSON.stringify(err));

@@ -671,6 +712,6 @@ },

cognitoUser.setDeviceStatusNotRemembered({
onSuccess: function(result) {
onSuccess: function (result) {
console.log('call result: ' + result);
},
onFailure: function(err) {
onFailure: function (err) {
alert(err.message || JSON.stringify(err));

@@ -685,6 +726,6 @@ },

cognitoUser.forgetDevice({
onSuccess: function(result) {
onSuccess: function (result) {
console.log('call result: ' + result);
},
onFailure: function(err) {
onFailure: function (err) {
alert(err.message || JSON.stringify(err));

@@ -768,9 +809,9 @@ },

cognitoUser.initiateAuth(authenticationDetails, {
onSuccess: function(result) {
onSuccess: function (result) {
// User authentication was successful
},
onFailure: function(err) {
onFailure: function (err) {
// User authentication was not successful
},
customChallenge: function(challengeParameters) {
customChallenge: function (challengeParameters) {
// User authentication depends on challenge response

@@ -833,15 +874,15 @@ var challengeResponses = 'challenge-answer';

cognitoUser.authenticateUser(authenticationDetails, {
onSuccess: function(result) {
onSuccess: function (result) {
var accessToken = result.getAccessToken().getJwtToken();
},
onFailure: function(err) {
onFailure: function (err) {
alert(err.message || JSON.stringify(err));
},
mfaSetup: function(challengeName, challengeParameters) {
mfaSetup: function (challengeName, challengeParameters) {
cognitoUser.associateSoftwareToken(this);
},
associateSecretCode: function(secretCode) {
associateSecretCode: function (secretCode) {
var challengeAnswer = prompt('Please input the TOTP code.', '');

@@ -851,3 +892,3 @@ cognitoUser.verifySoftwareToken(challengeAnswer, 'My TOTP device', this);

selectMFAType: function(challengeName, challengeParameters) {
selectMFAType: function (challengeName, challengeParameters) {
var mfaType = prompt('Please select the MFA method.', ''); // valid values for mfaType is "SMS_MFA", "SOFTWARE_TOKEN_MFA"

@@ -857,3 +898,3 @@ cognitoUser.sendMFASelectionAnswer(mfaType, this);

totpRequired: function(secretCode) {
totpRequired: function (secretCode) {
var challengeAnswer = prompt('Please input the TOTP code.', '');

@@ -863,3 +904,3 @@ cognitoUser.sendMFACode(challengeAnswer, this, 'SOFTWARE_TOKEN_MFA');

mfaRequired: function(codeDeliveryDetails) {
mfaRequired: function (codeDeliveryDetails) {
var verificationCode = prompt('Please input verification code', '');

@@ -878,3 +919,3 @@ cognitoUser.sendMFACode(verificationCode, this);

};
cognitoUser.setUserMfaPreference(smsMfaSettings, null, function(err, result) {
cognitoUser.setUserMfaPreference(smsMfaSettings, null, function (err, result) {
if (err) {

@@ -894,3 +935,3 @@ alert(err.message || JSON.stringify(err));

};
cognitoUser.setUserMfaPreference(null, totpMfaSettings, function(err, result) {
cognitoUser.setUserMfaPreference(null, totpMfaSettings, function (err, result) {
if (err) {

@@ -909,9 +950,9 @@ alert(err.message || JSON.stringify(err));

cognitoUser.authenticateUser(authenticationDetails, {
onSuccess: function(result) {
onSuccess: function (result) {
// User authentication was successful
},
onFailure: function(err) {
onFailure: function (err) {
// User authentication was not successful
},
mfaRequired: function(codeDeliveryDetails) {
mfaRequired: function (codeDeliveryDetails) {
// MFA is required to complete user authentication.

@@ -927,3 +968,3 @@ // Get the code from user and call

```js
cognitoUser.getUserData(function(err, userData) {
cognitoUser.getUserData(function (err, userData) {
if (err) {

@@ -939,3 +980,3 @@ alert(err.message || JSON.stringify(err));

cognitoUser.getUserData(
function(err, userData) {
function (err, userData) {
if (err) {

@@ -942,0 +983,0 @@ alert(err.message || JSON.stringify(err));

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc