https://github.com/instea/amazon-cognito-identity-js-promises
https://github.com/instea/amazon-cognito-identity-js-promises
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/instea/amazon-cognito-identity-js-promises
- Owner: instea
- License: isc
- Created: 2022-12-12T12:45:51.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-13T16:30:09.000Z (over 3 years ago)
- Last Synced: 2025-02-15T01:34:57.978Z (over 1 year ago)
- Language: TypeScript
- Size: 51.8 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# amazon-cognito-identity-js-promises
This package provides promisified version of [amazon-cognito-identity-js](https://github.com/aws-amplify/amplify-js/tree/master/packages/amazon-cognito-identity-js) - Amazon Cognito Identity SDK for JavaScript.
## Installation
```sh
npm install amazon-cognito-identity-js-promises
```
## Basic Usage
```js
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](https://github.com/aws-amplify/amplify-js/tree/master/packages/amazon-cognito-identity-js) for more examples.