Skip to content

Sample project of password-less & database-less socket authentication with Elixir, Phoenix and Elm.

Notifications You must be signed in to change notification settings

bigardone/passwordless-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PasswordlessAuth

This is the demo project for a new series I'll be writing on how to authenticate Phoenix socket connections with a password-less and database-less approach, inspired by Slack's magic link authentication.

Scenario

Have you ever found yourself adding HTTP basic authentication to a small admin panel of some sort? Have you ended up changing it for something way more complicated? How many times did this change leave you with a feeling of unnecessary over-engineering? This small experiment relies on OTP, Phoenix Token, and email sending, to build up a secure and straightforward authentication system for a Phoenix socket connection, used by a small Elm SPA application.

Why password-less and database-less?

Because, why not? I wanted it to be as simple as possible, taking advantage of some of the features which make Elixir and Phoenix so awesome.

Tutorial

  1. Project setup and the initial functionality for storing and verifying authentication tokens
  2. Sending authentication link emails and the user socket connection
  3. Setting up webpack as our asset bundler and the Elm single-page application

Running the project

To start your Phoenix server:

  • Install dependencies with mix deps.get
  • Install Elm dependencies with cd apps/passwordless_auth_web/assets/elm && elm package install
  • Install Node.js dependencies with cd apps/passwordless_auth_web/assets && npm install
  • Start Phoenix endpoint with mix phx.server

Now you can visit localhost:4000 from your browser.

Final result

Final result

Beautiful icons by https://icons8.com

About

Sample project of password-less & database-less socket authentication with Elixir, Phoenix and Elm.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages