• This repository has been archived on 11/Oct/2021
  • Stars
    star
    111
  • Rank 312,704 (Top 7 %)
  • Language
    JavaScript
  • License
    The Unlicense
  • Created over 7 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Stupid Simple Authentication

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

More Repositories

1

ipify-api

A public IP API service.
Go
1,712
star
2

django-skel

A modern Django (1.5) project skeleton.
Python
518
star
3

django-sslify

Force SSL on your Django site.
Python
336
star
4

django-twilio

A simple library for building twilio-powered Django webapps.
Python
327
star
5

skele-cli

A skeleton command line program in Python.
Python
294
star
6

simpleq

A simple, infinitely scalable, SQS based queue.
Python
165
star
7

flask-dynamo

DynamoDB integration for Flask.
Python
141
star
8

python-ipify

The official client library for ipify: A Simple IP Address API.
Python
138
star
9

chatapp

A simple WebRTC and Okta front-end app.
JavaScript
122
star
10

cryptocompare

A static website that compares cryptocurrency prices for popular currencies.
HTML
121
star
11

go-ipify

The official client library for ipify: A Simple IP Address API.
Go
117
star
12

python-amazonify

The simplest way to build Amazon Affiliate links, in Python.
Python
103
star
13

brute

Simple brute forcing in Python.
Python
101
star
14

django-heroku-memcacheify

Automatic Django memcached configuration on Heroku.
Python
100
star
15

svcc-auth

Demo code for my Silicon Valley Code Camp talk about authentication in Node.js!
JavaScript
97
star
16

pycall

A flexible python library for creating and using Asterisk call files.
Python
90
star
17

django-clear-cache

A simple Django management command which clears your cache.
Python
87
star
18

django-ganalytics

Simple Google Analytics integration for Django.
Python
48
star
19

pelican-minify

An HTML minification plugin for Pelican, the static site generator.
Python
47
star
20

django-heroku-postgresify

Automatic Django database configuration on Heroku.
Python
46
star
21

btc

Buy, sell, and transfer bitcoin instantly in your terminal!
Python
45
star
22

flask-heroku-cacheify

Automatic Flask cache configuration on Heroku.
Python
41
star
23

python-basicauth

An incredibly simple HTTP basic auth implementation.
Python
36
star
24

useragent-api

A random user agent API service.
Python
34
star
25

energy-tracker

A simple script (meant to be run via cron) that tracks your Mac laptop's energy usage in watt hours.
Shell
33
star
26

dot-tmux

My tmux dotfiles.
21
star
27

dot-vim

My vim dotfiles.
Vim Script
16
star
28

rdegges-www

My personal website and blog.
SCSS
10
star
29

flask-simple

SimpleDB integration for Flask.
Python
10
star
30

flask-heroku-rqify

Automatic RQ configuration for your Heroku Flask applications.
Python
10
star
31

dot-git

My git dotfiles.
8
star
32

dot-zsh

My ZSH dotfiles.
Shell
6
star
33

rdegges-blog

My personal writings.
6
star
34

cagi

An Asterisk 1.6+ compatible AGI library in C.
C
5
star
35

dog-name-picker

A Python script I used to pick my dog's name.
Python
4
star
36

node-camels

Easily convert to and from camelCase and under_score notation.
JavaScript
3
star
37

skele

A simple, modern, Express 4.x skeleton.
JavaScript
2
star
38

django-coverage

Fork of the popular django-coverage package.
2
star
39

dot-pip

My pip dotfiles.
2
star
40

bitrich-www

HTML
2
star
41

ice-breaker

A simple cross-platform CLI tool that destroys Amazon Glacier vaults.
Go
1
star
42

iterate-banner

Code I used to generate a cool opening video at the Iterate conference in 2018.
Python
1
star
43

dot-python

Dotfiles for managing Python.
Shell
1
star
44

dsobook.club

Source code for the DevSecOps Book Club website.
HTML
1
star
45

rondegges-www

My dad's website.
CSS
1
star
46

postgression-www

The public facing website for postgression.com.
1
star
47

codehappy-www

The public facing Code Happy website.
Pug
1
star
48

python-data247

An API client for Data 24-7.
Python
1
star
49

sofind

A simple CLI tool to find good StackOverflow users.
JavaScript
1
star
50

actiontest

testing...
1
star
51

generator-momma

yeoman generator for yo momma
JavaScript
1
star