Coder Social home page Coder Social logo

react-passport-example's Introduction

React Passport Example Application

An example application which combines a back-end which stores user data and front-end React.js application which handles user authentication sessions.

This application be easily separated into two completely different repositories.

Created using the tutorials below:

https://vladimirponomarev.com/blog/authentication-in-react-apps-creating-components https://vladimirponomarev.com/blog/authentication-in-react-apps-jwt

However, this version has replaced the React Router v3 which were used in the above tutorials with the most recent React Router v4 which has some major differences. I also made some minor tweaks to account for the NPM packages which had issues due to updates since the tutorial was published.

This application incorporates the following packages:

  • axios
  • bcryptjs
  • jsonwebtoken
  • mongoose
  • passport
  • react-router-dom
  • validator

Installation

After cloning the repo, follow the steps below:

$ cd react-passport-example
$ yarn install
$ sudo mongod
$ yarn run dev

When editing the files, run the following command for webpack to watch your files and bundle whenever changes are made:

$ yarn run bundle

Screenshots

Home page before login:

Alt Home Page

Sign up page:

Alt Signup Page

Login page:

Alt Login Page

Dashboard which is only accessible after login:

Alt Dashboard

react-passport-example's People

Contributors

jcerex avatar shouheiyamauchi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

react-passport-example's Issues

How to create modules

Ok, so I got it to work, but I am having a small issue I need the API url to be able to search collections etc.

how do I set that up?

I tried adding the following to api.js with no success

const express = require('express');
//const Pages = require('mongoose').model('Pages');

const router = new express.Router();

router.get('/dashboard', (req, res) => {
  res.status(200).json({
    message: "You're authorized to see this secret message.",
    // user values passed through from auth middleware
    user: req.user
  });
});

router.get('/pages', (req, res) => {
 /* Pages.find({}, function(err, docs) {
    if (!err){ 
        console.log(docs);
        process.exit();
    } else {throw err;}
  });
*/
  res.status(200).json({
    message: "You're authorized to see to edit pages.",
    // user values passed through from auth middleware
    user: req.user
  });
});

module.exports = router;

Mongoose install steps missing from README

The instructionsudo mongod (typo?) in the README presumes the installation of an executable. It would be nice to provide minimal guidance to users who are new to mongodb.

wont start on plesk server

I was trying to get this to work on a plesk server and it will not start.

Would be good if this would work from npm install and npm start

-- Other issues

  • Name needs to be split into firstname and lastname (when I made changes to the client side and rebuilt the file would not load (just showed blank white screen)

hot reloading

Hot reloading is not working for me. I have to wait several seconds for it be bundled and then I have to refresh the page.

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.