Skip to content

instea/amazon-cognito-identity-js-promises

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

amazon-cognito-identity-js-promises

This package provides promisified version of amazon-cognito-identity-js - Amazon Cognito Identity SDK for JavaScript.

Installation

npm install amazon-cognito-identity-js-promises

Basic Usage

import {
  AuthenticationDetails,
  CognitoUser,
  CognitoUserPool,
} from 'amazon-cognito-identity-js-promises';

const userPool = new CognitoUserPool({
  UserPoolId: '...',
  ClientId: '...',
});

// simple sign-in

try {
  const user = new CognitoUser({
    Pool: userPool,
    Username: 'myUsername',
  });
  user.setAuthenticationFlowType('USER_PASSWORD_AUTH');
  await user.authenticateUser(
    new AuthenticationDetails({
      Username: 'myUsername',
      Password: 'myPassword',
    })
  );
} catch (err) {
  console.error('error signing in', err);
}

console.log('current user', userPool.getCurrentUser());

See amazon-cognito-identity-js for more examples.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published