Skip to main content
Don’t have an Auth0 account? Sign up for free and get started with Auth0’s secure authentication and authorization platform.

AI Prompt

Using AI to integrate Auth0? Add this prompt to Cursor, Windsurf, Copilot, Claude Code or your favourite AI-powered IDE to speed up development.

Get Started

This quickstart shows how to add Auth0 authentication to a vanilla JavaScript application. You’ll create a modern single-page app with secure login functionality using plain JavaScript and the Auth0 SPA SDK.
1

Create a new project

Create a new JavaScript project for this Quickstart
Initialize the project and install a local development server
Create the basic project structure
2

Install the Auth0 SPA JS SDK

3

Setup your Auth0 App

Next up, you need to create a new app on your Auth0 tenant and add the environment variables to your project.You can choose to do this automatically by running a CLI command or do it manually via the Dashboard:
Run the following shell command on your project’s root directory to create an Auth0 app and generate a .env.local file:
4

Create the HTML structure and application logic

Create the application files:
5

Run your app

CheckpointYou should now have a fully functional Auth0 login page running on your localhost

Advanced Usage

If you need to call a protected API, you can get an access token:
For a smoother user experience, you can use popup-based login:
If you’re using Auth0 Organizations: