Nuxt Quickstart
Use this guide to add Choreo Identity & Access Management authentication to a Nuxt 3 application using the @thunderid/nuxt module.
What You Will Learn
- Create a new Nuxt 3 app
- Register the
@thunderid/nuxtmodule - Add working sign-in and sign-out
- Wrap your app with ThunderIDRoot
Prerequisites
- About 15 minutes
- Node.js 18.0 or later installed on your system
- npm, yarn, or pnpm
- Your preferred code editor
Create an Application
- Sign in to the Console at https://console.cloud.choreolabs.com/iam/. Select your project in the project switcher in the header.
- Navigate to Applications.
- Click Add application.
- From the Choose a type page, select Nuxt.
- Enter a name (e.g.
My Nuxt App). - Select how you want to sign in users (e.g., email/password, social login, etc.).
- Select Theme settings.
- Set Sign-in approach to Bring your own UI.
- Click Create.
Copy the Application ID from the General tab, under Quick copy. Also copy the Client secret from the window that pops up when the application is created; if lost, you can regenerate it from the application's Credentials tab.
Code in this guide uses https://<DATA_PLANE_URL> for your environment's data plane URL, where users sign in and tokens are issued. Replace it with the URL on the environment's Endpoints page. To open it, select your project, go to Deployment pipeline, and click Open environment on the environment's card. See Control Plane and Data Plane URLs.
Saving a change does not make it live. You author in the control plane, and your users sign in on a separate data plane, so a change takes effect in an environment only after you deploy it. Go to Deploy, deploy the latest version to your first environment, then promote it to the next environment when you are ready.
Auto-sync deploys saved changes to your first environment within seconds. Turning it on is your choice, per project. See Deploy a Version, or learn why you deploy and how auto-sync works.
Create a Nuxt App
Create a new Nuxt 3 app:
- npm
- pnpm
- Yarn
- Bun
- Deno
npm create nuxt@latest my-nuxt-app
cd my-nuxt-app
pnpm create nuxt@latest my-nuxt-app
cd my-nuxt-app
yarn create nuxt my-nuxt-app
cd my-nuxt-app
bun create nuxt@latest my-nuxt-app
cd my-nuxt-app
deno run -A npm:nuxi@latest init my-nuxt-app
cd my-nuxt-app
Install @thunderid/nuxt
Install the Choreo Identity & Access Management Nuxt module:
- npm
- pnpm
- Yarn
- Bun
- Deno
npm install @thunderid/nuxt
pnpm add @thunderid/nuxt
yarn add @thunderid/nuxt
bun add @thunderid/nuxt
deno add npm:@thunderid/nuxt
Register the Module
Add @thunderid/nuxt to your nuxt.config.ts:
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
compatibilityDate: '2025-07-15',
devtools: { enabled: true },
modules: ['@thunderid/nuxt'],
})
That's all the nuxt.config.ts change needed. The module reads all configuration from environment variables.
Set Environment Variables
Create a .env file in your project root with the following:
Replace <your-application-id> and <your-client-secret> with the values from your Choreo Identity & Access Management application.
Generate a random string for THUNDERID_SESSION_SECRET (at least 32 characters):
openssl rand -base64 32
NUXT_PUBLIC_THUNDERID_BASE_URL=https://<DATA_PLANE_URL>
NUXT_PUBLIC_THUNDERID_APPLICATION_ID=<your-application-id>
NUXT_PUBLIC_THUNDERID_SIGN_IN_URL=/signin
NUXT_PUBLIC_THUNDERID_SIGN_UP_URL=/signup
THUNDERID_CLIENT_SECRET=<your-client-secret>
THUNDERID_SESSION_SECRET=<a-random-secret-for-session-signing>
# DANGER: Disables ALL TLS verification. Only for local development with self-signed certs. NEVER use in production.
NODE_TLS_REJECT_UNAUTHORIZED=0
Wrap Your App with ThunderIDRoot
The <ThunderIDRoot> component mounts the full authentication provider tree. Wrap your application content with it in app.vue:
<template>
<ThunderIDRoot>
<NuxtPage />
</ThunderIDRoot>
</template>
The @thunderid/nuxt module auto-registers all components (e.g. <SignedIn>, <SignInButton>) and auto-imports all composables. You do not need to import them manually.
Add Sign-In and Sign-Up Pages
The <SignIn /> and <SignUp /> components render the sign-in and sign-up forms natively, using the Flow Execution API. Create the routes configured above as NUXT_PUBLIC_THUNDERID_SIGN_IN_URL and NUXT_PUBLIC_THUNDERID_SIGN_UP_URL:
<template>
<main>
<SignIn />
</main>
</template>
<template>
<main>
<SignUp after-sign-up-url="/" />
</main>
</template>
Build with Choreo Identity & Access Management Components
Update your home page with Choreo Identity & Access Management authentication components:
<template>
<main>
<SignedIn>
<UserDropdown />
</SignedIn>
<SignedOut>
<SignInButton>Sign In</SignInButton>
</SignedOut>
</main>
</template>
<SignInButton /> navigates to the local NUXT_PUBLIC_THUNDERID_SIGN_IN_URL route you created above, rather than redirecting to a Choreo Identity & Access Management-hosted page.
Run Your App
Start the development server:
- npm
- pnpm
- Yarn
- Bun
- Deno
npm run dev
pnpm run dev
yarn dev
bun run dev
deno task dev
You'll need a user to sign in with. If you haven't created one yet, open https://console.cloud.choreolabs.com/iam/, navigate to Users, and add a test user with an email and password.
Visit your app at 🌐 http://localhost:3000
You should see the <SignInButton /> button. Click it, you'll land on your application's own /signin page. Login with your test user, then return to your application with the user dropdown displayed.
Run the Sample App
The Nuxt sample is a working version of the app this guide builds. To run it instead of building the app yourself:
-
Download the sample from its releases and open its folder.
-
Create
.envin the sample's folder with your application's values:.envNUXT_PUBLIC_THUNDERID_BASE_URL=https://<DATA_PLANE_URL>NUXT_PUBLIC_THUNDERID_APPLICATION_ID=<your-application-id>THUNDERID_FLOW_SECRET=<your-flow-secret>THUNDERID_SESSION_SECRET=<a-random-secret-for-session-signing>NUXT_PUBLIC_THUNDERID_SIGN_IN_URL=/signinNUXT_PUBLIC_THUNDERID_SIGN_UP_URL=/signup -
Install the dependencies and start the app:
npm installnpm run devOn Windows, run these from a POSIX shell such as Git Bash or WSL. The sample's
devscript setsTMPDIRthe way a POSIX shell does. -
Open http://localhost:3000 and sign in.
What's Next
- Upgrade the Sign-In Flow: Add MFA, passkeys, or social login to your flow: no app code changes required.
- Nuxt SDK Reference: Explore the full API reference for the Nuxt SDK.
Was this page helpful?