Git Product home page Git Product logo

react-cognito's Introduction

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.

react-cognito's People

Contributors

dibell avatar kbrown avatar kbrown-axio avatar nokrosis avatar tcchau avatar winjer avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.