An easy to use authentication system that can easily be built in to your Express + HBS web apps.

Overview

yoAuth

An easy to use authentication system that can easily be built in to your Express + HBS web apps. Currently only supports local authentication, however will hopefully support Google/Apple/Facebook/etc auth in the future.

Example

# .env
SESSION_SECRET=(insert your session secret - can be anything)
MONGO_URI=(insert your personal mongo uri here)
<!-- index.hbs -->

Hello, {{user.fullName}}
<form action="/auth/logout" method="POST">
    <button type="submit">Logout</button>
</form>
// auth.js
require('dotenv').config();

const {YoAuth} = require('yoauth');
const mongoose = require('mongoose');

const auth = new YoAuth({
    mongoUri: process.env.MONGO_URI,
    sessionSecret: process.env.SESSION_SECRET,
    background: 'linear-gradient(115deg, rgba(247,141,145,1) 0%, rgba(66,189,210,1) 100%)',
    usernameField: "email",
    userModel: {
        name: 'user',
        schema: new mongoose.Schema({
            email: String,
            fullname: String,
            age: Number,
            password: String
        }, {
            timestamps: true
        }),
        args: []
    },
    signupCustomFields: [
        {
            label: "Full Name",
            name: "fullname",
            type: "string",
            placeholder: "John Doe"
        },
        {
            label: "Age",
            name: "age",
            type: "number",
            placeholder: "Age"
        }
    ]
});

module.exports = auth;
// index.js
const express = require('express');
const app = express();

const auth = require('./auth');

auth.configureServer(app, {
    path: '/auth'
});

app.set('view engine', 'hbs');
app.get('/', auth.ensureAuth, function(req, res, next) {
    res.render(`${__dirname}/index.hbs`, {user: req.user});
});

app.listen(3000, e => {
    if(e) throw e;
    console.log('Running on PORT 3000');
});

You can now visit http://localhost:3000/auth/signup to register!

You might also like...

Simple express request logger middleware for jsout.

jsout-express Simple express request logger middleware for jsout. Installation npm i jsout jsout-express -D Example Usage import {logger} from 'jsout'

Feb 25, 2022

Vue 3 + Typescript + Vite + Express

Vue 3 + Typescript + Vite + Express ็›ฎๅฝ•็ป“ๆž„

Oct 1, 2022

Express.js middleware implementation for Twitter OAuth 2.0 Client.

twitter-oauth2 Express.js middleware implementation for Twitter OAuth 2.0 Client. This module supports the following grant type available on twitter:

Dec 17, 2022

Node-sodium-jwt - Fast sodium-based crypto for signing and verifying json web tokens (JWT)

node-sodium-jwt Features Fast sodium-based crypto for hashing json web tokens (JWT) Relies on sodium-native to perform crypto. Built with TypeScript f

Jan 3, 2022

Oso is a batteries-included library for building authorization in your application.

Oso What is Oso? Oso is a batteries-included library for building authorization in your application. Oso gives you a mental model and an authorization

Jan 1, 2023

EveryAuth is the easiest way for your app to access APIs like Slack, Salesforce, or Github.

EveryAuth EveryAuth is the easiest way for your app to access APIs like Slack, Salesforce, or Github. import everyauth from "@fusebit/everyauth-expres

Dec 12, 2022

We are creating a Library that would ensure developers do not reinvent the wheel anymore as far as Authentication is concerned. Developers can easily register and download authentication codes that suits their need at any point.

We are creating a Library that would ensure developers do not reinvent the wheel anymore as far as Authentication is concerned. Developers can easily register and download authentication codes that suits their need at any point.

#AuthWiki Resource Product Documentation Figma Database Schema First Presentation Live Link API Documentation Individual Contributions User Activity U

Dec 2, 2022

This project shows how you can easily jwt protect your endpoints in web api apps built with node js.

This project shows how you can easily jwt protect your endpoints in web api apps built with node js.

JWT Protected NodeJs API This project shows how you can easily jwt protect your endpoints in web api apps built with node js. It is an easy and simple

Oct 19, 2021

The Frontend of Escobar's Inventory Management System, Employee Management System, Ordering System, and Income & Expense System

The Frontend of Escobar's Inventory Management System, Employee Management System, Ordering System, and Income & Expense System

Usage Create an App # with npx $ npx create-nextron-app my-app --example with-javascript # with yarn $ yarn create nextron-app my-app --example with-

Jan 2, 2023

This is a full-stack exercise tracker web application built using the MERN (MongoDB, ExpressJS, ReactJS, NodeJS) stack. You can easily track your exercises with this Full-Stack Web Application.

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

Dec 25, 2021

A small web app that tries to imitate the desktop web version of amazon site, you can add items to the basket, delete them, and have your user authentication feature thanks to Firebase.

A small web app that tries to imitate the desktop web version of amazon site, you can add items to the basket, delete them, and have your user authentication feature thanks to Firebase.

Features Here's the feature's included in this project ๐Ÿ‘จโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Login Page ๐Ÿ“ฆ Products Page ๐Ÿ›’ Cart and Checkout Page ๐Ÿ“ Sign up function with Goog

Aug 22, 2022

The authentication-server is a node app that handles user registration, authentication & authorization with JWT.

The authentication-server is a node app that handles user registration, authentication & authorization with JWT.

Authentication Server The authentication-server is a node app that handles user registration, authentication & authorization with JWT. Here is the REP

Jul 24, 2022

Lovefield is a relational database for web apps. Written in JavaScript, works cross-browser. Provides SQL-like APIs that are fast, safe, and easy to use.

Lovefield Lovefield is a relational database written in pure JavaScript. It provides SQL-like syntax and works cross-browser (currently supporting Chr

Jan 3, 2023

Socket.io-Express - A simple express project to learn how to use socket.io.

Socket.io-Express - A simple express project to learn how to use socket.io.

Socket.io Express A simple express project to learn how to use socket.io โœจ ๐Ÿ‘ถ Simple project This is a small project that has been designed to be usab

Sep 25, 2022

Remote Keyboard Tutoring System is a web-based system that can be attached to any keyboard synthesizer through a MIDI connector.

Remote Keyboard Tutoring System is a web-based system that can be attached to any keyboard synthesizer through a MIDI connector.

The Remote Keyboard Tutoring System is a web-based system that can be attached to any (electronic) keyboard synthesizer through a MIDI connector. Once our system is connected to the keyboard, the user can interactively learn, play or teach in combination with the web application that we provide.

Nov 15, 2022

An easy to implement marquee JQuery plugin with pause on hover support. I know its easy because even I can use it.

Simple-Marquee Copyright (C) 2016 Fabian Valle An easy to implement marquee plugin. I know its easy because even I can use it. Forked from: https://gi

Aug 29, 2022

This is a project that is used to execute python codes in the web page. You can install and use it in django projects, You can do any operations that can be performed in python shell with this package.

Django execute code This is a project that is used to execute python codes in the web page. You can install and use it in django projects, You can do

Nov 12, 2022

tsParticles - Easily create highly customizable particles animations and use them as animated backgrounds for your website. Ready to use components available for React, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Inferno.

tsParticles - Easily create highly customizable particles animations and use them as animated backgrounds for your website. Ready to use components available for React, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Inferno.

tsParticles - TypeScript Particles A lightweight TypeScript library for creating particles. Dependency free (*) and browser ready! Particles.js conver

Jan 4, 2023
Owner
null
The authentication-server is a node app that handles user registration, authentication & authorization with JWT.

Authentication Server The authentication-server is a node app that handles user registration, authentication & authorization with JWT. Here is the REP

OฤŸuz ร‡olak 18 Jul 24, 2022
Authentication solution for Express

Lockit Lockit is an authentication solution for Express. Check out the demo. It consists of multiple single purpose modules: lockit-login lockit-signu

Mirco Zeiss 445 Dec 28, 2022
Building an API on nodejs with registration system, authentication, CRUD of projects and tasks.

api-token-express Building an API on nodejs with registration system, authentication, CRUD of projects and tasks. API endpoints POST { "username":

MrDiniz 4 Jan 15, 2022
node.js auth package (password, facebook, & more) for Connect and Express apps

everyauth Authentication and authorization (password, facebook, & more) for your node.js Connect and Express apps. There is a NodeTuts screencast of e

Brian Noguchi 3.5k Dec 17, 2022
This package allows you to use Okta as your identity provider for use with Netlify's Role-based access control with JWT.

netlify-okta-auth This package allows you to use Okta as your identity provider for use with Netlify's Role-based access control with JWT. Who is this

Twilio Labs 8 Sep 17, 2022
Simple, unobtrusive authentication for Node.js.

Passport Passport is Express-compatible authentication middleware for Node.js. Passport's sole purpose is to authenticate requests, which it does thro

Jared Hanson 21k Jan 7, 2023
A small project with 3 accounts mapped to 3 resources using auth0 as an authentication service.

Auth0WithExpressJS Quickstart install dependencies for backend and start backend cd Auth0WithExpressJS\Back && npm start install dependencies for fron

RYMND 16 Aug 21, 2021
Role based authentication for NodeJS and ExpressJS

Authentication service made for ExpressJS and MongoDB using JWT. We tried to make it as clean and structured as possible. We also provide this documentation on how to install and integrate it with your own application.

null 4 Oct 3, 2021
Edge-side GitHub authentication

cloudflare-workers-github-auth Edge-side GitHub authentication example. Requirements node.js (v16.13.1 or later) Installation Clone this repository an

Yoshiaki Sugimoto 7 Feb 21, 2022
node.js/express module to authenticate users without password

Passwordless Passwordless is a modern node.js module for Express that allows authentication and authorization without passwords by simply sending one-

Florian Heinemann 2k Dec 14, 2022