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

react-cognito-dg

v1.5.7

Published

Use Amazon Cognito with React and Redux

Downloads

6

Readme

React Cognito

You can now use Amazon Cognito to handle authentication and authorization for your mobile and web applications. This is particularly useful for serverless single-page applications (SPAs). SPAs can be hosted in S3 buckets and use AWS services such as API Gateway, Lambda, S3, DynamoDB and others without requiring a separate server.

This Javascript package provides a set of React components and supporting code to make integrating with Cognito very easy, if you are using React and Redux.

Full documentation for this package is available.

This package is available on npm.

Introduction

This library should be installed using npm, and depends on React, Redux, React Router, and of course the underlying AWS packages.

In a nutshell this library allows you to write all of your own forms and UI components, but abstracts out all of the interfacing with Cognito, and determining which parts of UI should be rendered.

Redux State

This package depends entirely on Redux to manage client-side state. As well as storing important state variables there is also a client-side state machine that helps you display the correct UI depending on the state of the user with respect to their authentication status.

All state is stored in redux under the key cognito. in there you can find:

user

This is either null or a valid CognitoUser object. You are unlikely to need to use this yourself, and it is located by components using the context.

state

This is a string indicating the client-side state. See State Machine below.

error

If errors are encountered from the Cognito API they are stored here, and then exposed as appropriate to UI components. This means most error handling is transparent and automatic for you.

userPool

The CognitoUserPool object, used to create users.

attributes

This contains all the user's Cognito attributes, if you've chosen to fetch them at login (the default).

creds

A CognitoIdentityCredentials object, used to authenticate against a Federated User Pool. Contains no secret material.

config

The configuration provided by the application, used to contact Cognito.