huyhong / example-auth

User auth, session & JWT example for ReactQL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Users, sessions and auth

This ReactQL project demonstrates one possible way you might implement user/password authorisation.

It also adds Passport.js with a sample Facebook login.

Features

  • User sign-up form, with field validation (email validation via isemail)
  • Passport.js integration
  • User/password and Facebook login (using Graph API v2.11)
  • In-memory SQLite DB with users and sessions tables, running via Sequelize v4
  • Server-side sessions. Deleting the DB entry remotely kills the session
  • Password hashing via bcrypt
  • GraphQL types representing users, sessions, JWT tokens, field errors
  • Semantic UI React components and styling
  • JWT tokens -- stored in both localStorage and via cookies, for subsequent SSR requests to render authenticated content on the server side, and for stateless environments such as mobile
  • No modifications to the kit -- pure userland code

Video walk-through

I've uploaded a 28 minute video on YouTube, which explains the concepts used in this project entitled User authentication with GraphQL + DB + JWT

Find it here: https://youtu.be/s1p4R4rzWUs

Kit version

Based on ReactQL kit v2.9.5

About

User auth, session & JWT example for ReactQL


Languages

Language:JavaScript 98.4%Language:CSS 0.9%Language:HTML 0.7%