Overview
Auth0 is an authentication and authorization platform that supports social logins, enterprise federation, and passwordless authentication. This guide shows how to integrate Auth0 with InsForge in a Next.js application. Auth0 handles authentication, while InsForge manages data authorization through Row Level Security (RLS) policies. On each server request, the app signs a fresh InsForge JWT from the Auth0 session using your InsForge secret, so InsForge accepts it natively.- Live Demo — A sample app using Auth0 authentication with InsForge
- Source Code — GitHub repository for the sample app
Prerequisites
- An InsForge project (self-hosted or cloud)
- An Auth0 account and tenant
- A Next.js application (or any framework — adjust the client code accordingly)
Step 1: Create an Auth0 Application
- Log in to your Auth0 Dashboard
- Go to Applications > Applications > Create Application
- Choose Regular Web Application and give it a name (if prompted to select a technology, choose Next.js or skip — it only affects which quickstart guide Auth0 shows you)
- In the Settings tab, configure:
- Allowed Callback URLs:
http://localhost:3000/auth/callback - Allowed Logout URLs:
http://localhost:3000
- Allowed Callback URLs:
- Note down the Domain, Client ID, and Client Secret
Step 2: Set Up Your InsForge Project
Create a new project or link an existing one:Step 3: Set Up Your Application
Install the required dependencies:.env.local:
Step 4: Set Up InsForge Integration
Ask your agent to complete the following steps:1. Set up Auth0 authentication
lib/auth0.ts), middleware (middleware.ts), and Auth0Provider wrapper (app/layout.tsx).
2. Create the InsForge client utility
lib/insforge.ts) that gets the Auth0 user via auth0.getSession(), signs a JWT with the InsForge secret, and passes it as edgeFunctionToken.
3. Create the database schema
requesting_user_id() helper function (since Auth0 user IDs are strings, not UUIDs) and a todos table with Row Level Security policies.
4. Build the todo list page
Step 5: Run Your Application
http://localhost:3000 and sign up with a new user through Auth0.
Since authentication is handled entirely by Auth0, you will not see any users in the InsForge dashboard under Auth > Users. User records are managed in the Auth0 Dashboard — check User Management > Users there to confirm the sign-up was successful.
