Skip to main content

Nuxt Quickstart

Use this guide to add ThunderID authentication to a Nuxt 3 application using the @thunderid/nuxt module.

What You Will Learn

  • Create a new Nuxt 3 app
  • Register the @thunderid/nuxt module
  • 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
1

Run ThunderID

Start a local ThunderID instance. Pick the method that works best for you:

$npx thunderid

Requires Node.js 18+

Full install guide →

Once it's running, the console is available at https://localhost:8090/console.

2

Create an Application

  1. Sign in to the Console.

    Test User

    If you used the default setup, sign in to the Console as admin with the password generated during setup and printed to the setup output (unless you supplied your own).

  2. Navigate to Applications.

  3. Click Add Application.

  4. From the Choose a type page, select Nuxt.

  5. Enter a name (e.g. My Nuxt App).

  6. Select how you want to sign in users (e.g., email/password, social login, etc.).

  7. Select Theme settings.

  8. Set Sign-In Approach to Bring Your Own UI.

  9. Click Create.

Note

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.

3

Create a Nuxt App

Create a new Nuxt 3 app:

npm create nuxt@latest my-nuxt-app
cd my-nuxt-app
4

Install @thunderid/nuxt

Install the ThunderID Nuxt module:

npm install @thunderid/nuxt
5

Register the Module

Add @thunderid/nuxt to your nuxt.config.ts:

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.

6

Set Environment Variables

Create a .env file in your project root with the following:

Configuration

Replace <your-application-id> and <your-client-secret> with the values from your ThunderID application.

Generate a random string for THUNDERID_SESSION_SECRET (at least 32 characters):

openssl rand -base64 32
.env
NUXT_PUBLIC_THUNDERID_BASE_URL=https://localhost:8090
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
7

Wrap Your App with ThunderIDRoot

The <ThunderIDRoot> component mounts the full authentication provider tree. Wrap your application content with it in app.vue:

app.vue
<template>
<ThunderIDRoot>
<NuxtPage />
</ThunderIDRoot>
</template>
Auto-imports

The @thunderid/nuxt module auto-registers all components (under the ThunderID prefix, e.g. <ThunderIDSignedIn>) and auto-imports all composables. You do not need to import them manually.

8

Add Sign-In and Sign-Up Pages

The <ThunderIDSignIn /> and <ThunderIDSignUp /> 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:

app/pages/signin.vue
<template>
<main>
<ThunderIDSignIn />
</main>
</template>
app/pages/signup.vue
<template>
<main>
<ThunderIDSignUp after-sign-up-url="/" />
</main>
</template>
9

Build with ThunderID Components

Update your home page with ThunderID authentication components:

app/pages/index.vue
<template>
<main>
<ThunderIDSignedIn>
<ThunderIDUserDropdown />
</ThunderIDSignedIn>
<ThunderIDSignedOut>
<ThunderIDSignInButton>Sign In</ThunderIDSignInButton>
</ThunderIDSignedOut>
</main>
</template>
info

<ThunderIDSignInButton /> navigates to the local NUXT_PUBLIC_THUNDERID_SIGN_IN_URL route you created above, rather than redirecting to a ThunderID-hosted page.

10

Run Your App

Start the development server:

npm run dev
Test credentials

You'll need a user to sign in with. If you haven't created one yet, open https://localhost:8090/console, navigate to Users, and add a test user with an email and password.

Success

Visit your app at 🌐 http://localhost:3000

You should see the <ThunderIDSignInButton /> 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.

What's Next

Explore with AI

ThunderID LogoThunderID Logo

Product

DocsAPIsSDKs
© Copyright Linux Foundation Europe.For web site terms of use, trademark policy and other project policies please see https://linuxfoundation.eu/en/policies.