Coder Social home page Coder Social logo

shuaibiyy / react-redux-auth0-kit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from amaury1093/react-redux-auth0-kit

0.0 3.0 0.0 349 KB

Minimal starter boilerplate project with CRA, React, Redux, React Router and Auth0 authentication

License: MIT License

HTML 8.41% JavaScript 90.97% CSS 0.62%

react-redux-auth0-kit's Introduction

React Redux Auth0 Kit

Minimal starter boilerplate project with React, Redux, React Router and Auth0 authentication

Live demo

A live demo of this project with a simple Facebook login via Auth0 is available here: https://react-redux-auth0.firebaseapp.com.

Getting started

First create an auth0 account. Then run the following commands. Make sure your src/utils/config.js file has the correct values from your auth0 account.

# Install dependencies
npm install

# Copy configuration and replace with your own
cp src/utils/config.example.js src/utils/config.js

# Run
npm start

Open http://localhost:3000 to see the app running.

Features

Auth0

Auth0 helps you to:

  • Add authentication with multiple authentication sources, either social like Google, Facebook, Microsoft Account, LinkedIn, GitHub, Twitter, Box, Salesforce, among others, or enterprise identity systems like Windows Azure AD, Google Apps, Active Directory, ADFS or any SAML Identity Provider.
  • Add authentication through more traditional username/password databases.
  • Add support for linking different user accounts with the same user.
  • Support for generating signed Json Web Tokens to call your APIs and flow the user identity securely.
  • Analytics of how, when and where users are logging in.
  • Pull data from other sources and add it to the user profile, through JavaScript rules.

AuthService

The library auth0-lock provides the user authentication, and I also have a src/utils/AuthService.js module to wrap this Lock Widget usage and manage the localStorage items.

I'm using the latest Auth0 Lock 10 version in popup mode, which means here's the flow:

  • ->Login widget shows login panel
  • ->Redirect to auth0 to check login creds (done in hidden iframe)
  • ->Redirect back to localhost:3000/callback (done in hidden iframe)
  • ->AuthService waits for 'authenticated' event to fire
  • ->Redirects back to homepage

Libraries

This starter kit is minimal, only the strict necessary is added.

Library Description
react Facebook's library for building user interfaces 
redux State container for JavaScript apps
react-router Declarative routing for React apps using navigational components
create-react-app All tooling needed for react apps

The starter kit includes a working example app that puts all of the above to use.

Development

create-react-app takes care of tooling, development server, live reload, building, testing.

HMR is unfortunately not enabled during development, because create-react-app doesn't support it.

If you wish to directly use Webpack instead of create-react-app, you can eject any time by running npm run eject. Read here for more information about ejecting.

Testing

npm run lint to check linting errors. This projects follows eslint-config-react-app style.

npm test to run all tests. This project uses jest to run tests, and enzyme for unit testing React components.

Deployment

Out of the box, this starter kit is deployable by serving the ~/build folder generated by npm run build.

License

MIT. See LICENSE file.

Future ideas

  • Add a side effects library (redux-saga, redux-observable) to manage side effects. It makes the code more redux-compliant, however it goes against minimalism.
  • Any other ideas are welcome! Just post an issue.

Donations

If you like this project, I would really appreciate small donations. Here's my Ethereum address: 0xa395447BF15f7525484C0378c76627D45ADE0B96.

react-redux-auth0-kit's People

Contributors

amaury1093 avatar benschaaf avatar martinvd avatar

Watchers

 avatar  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.