Giter VIP home page Giter VIP logo

ss-auth's Introduction

ss-auth

Stupid-Simple Authentication

This project contains code which shows how to implement your own user authentication in a Node.js web app with MongoDB.

This project is meant to go along with the talk I gave at Twilio Signal 2017. The talk walks you through how authentication works, from the ground up.

Talk on youtube

Slides

Installation

Installing this project is simple, run the following commands:

$ git clone https://github.com/rdegges/ss-auth.git
$ cd ss-auth
$ npm install

Next, you need to set two environment variables:

  • SESSION_SECRET_KEY
  • JWT_SIGNING_KEY

The SESSION_SECRET_KEY value must be a long, randomly generated string. This value should be unique on your production servers, and never checked into version control.

The JWT_SIGNING_KEY must be a randomly generated, 256-byte, base64 encoded string. You can generate this value using the secure-random node library like so:

const secureRandom = require("secure-random");

console.log(secureRandom(256, { type: "Buffer" }).toString("base64"));

Like the SESSION_SECRET_KEY, JWT_SIGNING_KEY must also never be checked into version control, and must be the same on all production servers.

Finally, you can run:

$ npm start

To launch the web server.

NOTE: You must have MongoDB installed and working locally in order to run this project. It will work with all the default MongoDB options.

TIP: Read through the settings specified in settings.js. There are several options you will want to enable when running a production website.

Purpose

This project shows how to implement basic user authentication in a Node web app. The accompanying talk explains how HTTP authentication works in a ground up way, explaining how each little piece works behind the scenes.

If you've ever wanted to know how authentication works, see the accompanying talk.

Questions

Got questions? Hit me up! I'm [email protected].

ss-auth's People

Contributors

dmiracle avatar rdegges 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

ss-auth's Issues

Should I ignore the use of JWT?

Hello watched your talk on authentication from a few years back, was pretty helpful in understanding auth.

I was wondering, during the talk you didn't mention use of JWT but it's in the source code.

So I'm sorta confused, under the login it seems to create a JWT upon successful login. But during the talk you seemed to generate a different token.

Thanks

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.