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.

Application Keys

When you signed up for Auth0, you were invited to create a new client.

There are some details about this client that your application needs to know about to properly communicate with Auth0. These include your Client ID, Domain, and Client Secret. You can retrieve these values from the settings area for your client in the Auth0 dashboard.

Please note that if you download the samples available for this tutorial, these keys will be pre-populated for you. If you have created more than one client in your account, the sample will come with the values for your Default App.

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