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.
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.
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.
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 └── ...
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.
Auth0's Lock widget and
auth0.js library are used throughout these quickstarts. These scripts can be obtained from the following CDN links:
Running the Sample Applications
After installing the dependencies for each of the samples, start the application:
With everything set, the app will be available at