Skip to main content

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.
Prerequisites: Before you begin, ensure you have the following installed:Vue Version Compatibility: This quickstart works with Vue 3.x and newer.

Get Started

This quickstart demonstrates how to integrate Auth0 authentication into a Vue.js 3 application. You’ll build a responsive single-page app with secure user authentication using Vue’s composition API and the Auth0 Vue SDK.
1

Create a new project

Create a new Vue 3 project for this Quickstart
Open the project
2

Install the Auth0 Vue 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 file:
4

Configure the Auth0 Plugin

src/main.ts
5

Create Authentication Components

Create component files
And add the following code snippets
6

Run your app

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

Advanced Usage

Use Vue Router’s navigation guards to protect specific routes:
src/router/index.ts
Configure your Auth0 plugin to include an API audience and make authenticated requests:
src/main.ts
Then make authenticated API calls in your components:
src/components/ApiCall.vue
Create reusable composables for common authentication patterns:
src/composables/useAuthenticatedUser.ts
Usage in components:
src/components/UserDashboard.vue