Skip to main content

Nuxt

Official

Server-rendered authentication for Nuxt applications, out of the box.

API reference

Full reference

Every export is fully typed. The signatures and props below come from the package's own reference documentation, so what is listed here is what the installed version ships.

Composables
Components
Middleware
Utilities
Configuration
Errors
Server
hookuseThunderID()

The

useThunderID composable provides access to the ThunderID authentication context in Nuxt applications. It exposes reactive auth state and SSR-safe methods for signing in, signing out, and signing up. This composable is auto-imported and available in every component, page, and composable without an explicit import.

Returns
isSignedIn
ComputedRef

Whether the user is currently authenticated

isLoading
ComputedRef

Whether an auth operation is in progress

isInitialized
ComputedRef

Whether the SDK has finished initializing

user
ComputedRef<User \

The authenticated user object, or `null` if not signed in

currentOrganizationUnit
ComputedRef<CurrentOrganizationUnit | null>

The organization unit the session was issued for, read on the server from its `ouId`, `ouHandle`, and `ouName` claims for display only, or `null`

signIn
(...args) => Promise

Initiate the sign-in flow

signOut
() => Promise

Sign out the current user

signUp
(...args) => Promise

Initiate the sign-up flow

getAccessToken
() => Promise

Get a client-safe access token via `/api/auth/token`

getCurrentOrganizationUnit
() => Promise<CurrentOrganizationUnit | null>

Resolve with the value of `currentOrganizationUnit`

switchOrganizationUnit
(organizationUnitId: string, options?: SwitchOrganizationUnitOptions) => Promise<undefined>

Sign in again bounded to another organization unit. Sends the browser to `/api/auth/signin?ouId=<id>`, and the callback replaces the session only when the sign-in succeeds

Example
<script setup lang="ts">
const { isSignedIn, user, signIn, signOut } = useThunderID()
</script>
<template>
<div>
<p v-if="isSignedIn">Welcome, {{ user?.displayName }}!</p>
<button v-if="isSignedIn" @click="signOut()">Sign Out</button>
<button v-else @click="signIn()">Sign In</button>
</div>
</template>

Get started

Provider, session, and a protected route, start to finish.

Connect your application

Getting started / Connect your application / Nuxt

Open in docs

The quickstart is maintained alongside the rest of the getting-started guides so it stays in step with the platform. This page covers the package itself.

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.