/PasswordlessExample

proof-of-concept for authentication using Passwordless gem only that allows user-choice between: • Email • SMS

Primary LanguageRuby

What

This is a proof-of-concept for authentication using Passwordless gem only that allows user-choice between: • Email • SMS

Step 1

passwordless-example1

Step 2

PasswordlessExample 2024-08-16 15-42-05

The user then logs in via 6-digit code ubiqutiously. To do this, several modifications to Passwordless's code needed to be made, including passwordless config.after_session_save as well the sessions_controller (I was oddly unable to monkeypatch here so I copied the whole sessions_controller file to achieve this.)

Users not already in the database are created on the fly, if they don't exist.

About

Node + Ruby versions are in .node-version and .ruby-version, respectively.

Setup

bin/setup

Start Rails

bin/dev

Run Specs

run with bin/rake

Your .env.local file must contain

  • credentials not included *
TWILIO_ACCOUNT_SID=
TWILIO_AUTH_TOKEN=
TWILIO_SENDER_NUMBER=
SENDGRID_SMTP_ADDRESS=smtp.sendgrid.net
SENDGRID_SMTP_PORT=587
SENDGRID_SMTP_PASSWORD=
DEFAULT_FROM_ADDRESS=support@domain.com

SENDGRID_SMTP_PASSWORD is also known as the API key which you get from the Sendgrid interface. TWILIO_SENDER_NUMBER should begin with +1 and be a valid and approved sender number on your associated Twilio account.