Node.js Introduction

This multistep quickstart guide will walk you through setting up and managing authentication in your Node.js web apps using Auth0. Each step demonstrates how to implement a specific feature of Auth0 and is accompanied by a downloadable sample project showing the complete solution.

Create an Application

Get your credentials (Domain, Client ID, and Client Secret) from the dashboard. The sample is pre-configured with your Default App credentials.

App Dashboard

Configure Callback URLs

A callback URL is a URL in your application where Auth0 redirects to after the user has authenticated. You can whitelist callback URLs for your app in the Callback URL field in your Application Settings. If no callback URLs are set, a mismatch error will be displayed when a user logs in.

Structure

The sample projects which accompany each of these steps will have the following directory structure:

├── app.js
├── bin
│   └── www
├── package.json
├── public
│   └── stylesheets
│       └── style.css
├── README.md
├── routes
│   ├── index.js
│   └── ...
└── views
    ├── index.jade
    └── ...

Dependencies

All the project dependencies are managed by npm and listed in the package.json file for each of the samples.

Run the following command to install the required packages.

npm install

Auth0's Lock widget and auth0.js library are used throughout these quickstarts. These scripts can be obtained from the following CDN links:

Lock <script src="https://cdn.auth0.com/js/lock/10.6/lock.min.js"></script>

auth0.js <script src="https://cdn.auth0.com/w2/auth0-7.4.min.js"></script>

Running the Sample Applications

After installing the dependencies for each of the samples, start the application:

npm start

With everything set, the app will be available at localhost:3000.

Next Tutorial
2. Login
Use Auth0 for FREECreate free Account