npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aws-cognito-wrapper

v1.1.2

Published

This is a wrapper for the amazon-cognito-identity-js project.

Downloads

10

Readme

Amazon Cognito Identity SDK for JavaScript Wrapper

Build status: N|Solid

Interacting with the existing Amazon Cognito Identity SDK for JavaScript proved a little painful - you had to do a lot of plumbing to do to perform simple tasks, which normally meant you had to wrap the SDK code in a repository of some sort to simplify things. (Not to mention that if you use automated tests at all, you'd need to write tests for all of this code).

In order to make things easier on myself (and others) - I've wrapped the logic most often used in the SDK, which now only requires you to include the wrapper which will perform all the plumbing for you, only requiring you to send through a few parameters for each method.

Right now, not all methods are wrapped, but feel free to submit a pull request for any new wrapped methods.

User attributes

User attributes can be passed to the methods in the following format:

[
    {
        name: 'Some Attribute Name',
        value: 'Some Attribute Value
    },
    {
        name: 'Another Attribute Name',
        value: 'Another Attribute Value
    }
}

User functions

Authenticate a user

const cognito = require('aws-cognito-wrapper');
wrapper.UserService.auth(username, password, userPoolId, clientId)
    .then(// Handle result here)
    .catch(// Handle exception here);

Create a user

const cognito = require('aws-cognito-wrapper');
wrapper.UserService.create(username, password, userPoolId, clientId, attributes)
    .then(// Handle result here)
    .catch(// Handle exception here);

See the User attributes section for the expected format of the attributes parameter.

Confirm user registration

const cognito = require('aws-cognito-wrapper');
wrapper.UserService.confirmRegistration(username, confirmationCode, userPoolId, clientId)
    .then(// Handle result here)
    .catch(// Handle exception here);

Resend user confirmation code

const cognito = require('aws-cognito-wrapper');
wrapper.UserService.resendConfirmationCode(username, userPoolId, clientId)
    .then(// Handle result here)
    .catch(// Handle exception here);

Get user attributes

const cognito = require('aws-cognito-wrapper');
wrapper.UserService.getAttributes(username, userPoolId, clientId)
    .then(// Handle result here)
    .catch(// Handle exception here);

Delete user attributes

const cognito = require('aws-cognito-wrapper');
wrapper.UserService.deleteAttributes(username, attributeNames, userPoolId, clientId)
    .then(// Handle result here)
    .catch(// Handle exception here);

The attributeNames parameter is simply an array of the attribute names.

Update user attributes

const cognito = require('aws-cognito-wrapper');
wrapper.UserService.updateAttributes(username, attributes, userPoolId, clientId)
    .then(// Handle result here)
    .catch(// Handle exception here);

See the User attributes section for the expected format of the attributes parameter.

Change user password

const cognito = require('aws-cognito-wrapper');
wrapper.UserService.changePassword(username, oldPassword, newPassword, userPoolId, clientId)
    .then(// Handle result here)
    .catch(// Handle exception here);

Send forgot password notification

const cognito = require('aws-cognito-wrapper');
wrapper.UserService.forgotPassword(username, userPoolId, clientId)
    .then(// Handle result here)
    .catch(// Handle exception here);

Remove a user

const cognito = require('aws-cognito-wrapper');
wrapper.UserService.remove(username, userPoolId, clientId)
    .then(// Handle result here)
    .catch(// Handle exception here);