Skip to main content
This Quickstart is currently in Beta. We’d love to hear your feedback!
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 demonstrates how to add Auth0 authentication to a Cap’n Web application. You’ll build a modern RPC-based web application with secure login functionality using Cap’n Web’s JavaScript framework and the Auth0 SPA SDK.
1

Create a new project

Create a new Cap’n Web project for this Quickstart
Initialize the project and install dependencies
Create the basic project structure
Set up your package.json scripts for development:
2

Install the Auth0 SPA JS SDK

Install the Auth0 SPA JS SDK to handle authentication:
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 file:
4

Create the server

Create the Cap’n Web server with Auth0 integration:
5

Create the client interface

Create the frontend HTML and JavaScript files:
6

Run your app

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

Advanced Usage

Enhance security by adding additional validation and rate limiting to your RPC methods:
server/profile-service.js
Implement proper WebSocket connection handling with reconnection logic:
client/enhanced-rpc-client.js
Replace in-memory storage with a database for production use:
server/database.js