This page explains how to add user authentification with Auth0
Auth0 is a cloud-based platform that provides authentication and authorization services for applications. It allows developers to authenticate users using a variety of methods, including social logins (Google, Twitter, Facebook...), single sign-on, and multi-factor authentication. Auth0 also provides tools for managing user profiles and permissions, as well as API security and access control. It is designed to make it easy for developers to add secure authentication and authorization to their applications, without having to build these capabilities from scratch.
The following has been performed with the following versions:
Let's start by creating the Node.js project:
npm init -y
Let's now install the required packages
expressfor the Node.js framework
dotenvfor environment variable
express-openid-connectfor authentification with Auth0
npm install express dotenv express-openid-connect
Create an account on Auth0.
Once your logged, create a new application. Set your application name and select regular Web Application:
Select Node.js app:
Then create a new Node.js project (Explore Sample App):
The next page is the configuration page. Leave the default parameters and click on Save And Download App.
A file name
01-login.zip should be downloaded/
Unzip the file in your project folder.
[Optional] Note that I use Volta to run any version of Node.js. In my case, I ran:
volta install email@example.com
volta install firstname.lastname@example.org
Pin you Node.js and npm version in the project:
volta pin email@example.com
volta pin firstname.lastname@example.org
Execute the following commands in the sample's directory:
npm install npm start
In your favorite browser, go to
Log-in, go to your profile page and check your profil information: