API reference
The public surface of
@thunderid/vue, as documented in its reference pages.useThunderID()The `useThunderID` composable provides access to the ThunderID authentication context in Vue applications. It allows you to retrieve authentication state, user information, and other context values managed by the ``.
isSignedInbooleanWhether the user is currently signed in
isLoadingbooleanWhether an authentication operation is in progress
userUser \The authenticated user object, or `null` if not signed in
organizationOrganization \The current active organization
signIn(...args) => Promise<User \Initiates the sign-in flow
signOut(...args) => PromiseSigns the current user out
signUp(...args) => PromiseInitiates the sign-up flow
getAccessToken() => PromiseReturns the current access token
getDecodedIdToken() => PromiseReturns the decoded ID token payload
http{ request, requestAll }Authenticated HTTP client (see Accessing Protected APIs)
<script setup>
import { useThunderID } from '@thunderid/vue'
const { isSignedIn, user, signIn, signOut } = useThunderID()
</script>
<template>
<div>
<template v-if="isSignedIn">
<p>Welcome, {{ user?.name }}!</p>
<button @click="signOut()">Sign Out</button>
</template>
<template v-else>
<button @click="signIn()">Sign In</button>
</template>
</div>
</template><ChangeCredential />The `ChangeCredential` component renders a form that lets a signed-in user set a new value for one of their own credentials. It collects only a new value and its confirmation, checks it against the applicable rules as the user types, and posts the change to ThunderID. It reads the rules it needs from the user type schema already resolved by `ThunderIDProvider` (`GET /users/me/meta`), so it adds no network request beyond the write itself. Every default label, placeholder, and message is built from the credential attribute's own `displayName` in that schema, so it always matches whatever an admin named it there. By default it manages the `password` credential. To manage a different one, for example a PIN declared on the user type schema, set `attribute`; render the component once per credential to let a user manage more than one. :::note `ChangeCredential` collects only a new value and its confirmation, not the account's existing value. The self-service credential write path does not verify the current value today, so asking for one would only teach the user a false sense of security. Once server-side current-value verification ships, that field returns without a breaking change to this component's public props. :::
attributeoptionalstringThe credential attribute this instance manages, any attribute the user type schema declares `credential: true` for. Defaults to `'password'`.
cardLayoutoptionalbooleanWhether to wrap the form in a bordered card. Defaults to `false`.
classNameoptionalstringAdditional CSS class added to the root element. Defaults to `''`.
policyoptionalPasswordPolicyThe rules the new value must satisfy. Defaults to the applicable rules from the user type schema.
preferencesoptionalPreferencesComponent-level preference overrides, including i18n.
showRequirementsoptionalbooleanWhether to render the live requirement checklist. Defaults to `true`.
titleoptionalstringOverrides the default `"Change {credential}"` heading. Pass an empty string to omit the heading entirely. Defaults to a translated, schema-derived heading.
<script setup>
import { ChangeCredential } from '@thunderid/vue'
</script>
<template>
<div>
<h2>Security</h2>
<ChangeCredential />
</div>
</template><Loading />The `Loading` component renders its default slot while the authentication state is being determined. It checks the current authentication state and displays a loading indicator or custom content during the initial authentication check. Once authentication is complete, it renders an optional `#fallback` slot or nothing by default. This makes it ideal for providing user feedback during the initial app load or authentication verification.
<script setup>
import { Loading } from '@thunderid/vue'
</script>
<template>
<Loading>
<div>Checking authentication...</div>
</Loading>
</template><SignInButton />The `SignInButton` component initiates the sign-in flow when clicked. It automatically handles loading state and error handling, and supports custom UI via a scoped default slot. If a `signInUrl` is configured on the ``, the button navigates to that URL instead of triggering the embedded flow.
signInOptionsoptionalRecordSign-in options forwarded to the underlying client. Overrides any `signInOptions` set on ``.
classoptionalstringCSS class applied to the rendered button
stylestring \Inline styles applied to the rendered button
<script setup>
import { SignInButton } from '@thunderid/vue'
</script>
<template>
<SignInButton />
</template><SignOutButton />The `SignOutButton` component signs out the current user, clears their session, and revokes authentication tokens when clicked. It automatically handles loading state and error handling, and supports custom UI via a scoped default slot.
classoptionalstringCSS class applied to the rendered button
stylestring \Inline styles applied to the rendered button
<script setup>
import { SignOutButton } from '@thunderid/vue'
</script>
<template>
<SignOutButton />
</template><SignUpButton />The `SignUpButton` component triggers the sign-up (registration) flow when clicked. It automatically handles loading state and error handling, and supports custom UI via a scoped default slot. If a `signUpUrl` is configured on the ``, the button navigates to that URL instead of triggering the embedded flow.
classoptionalstringCSS class applied to the rendered button
stylestring \Inline styles applied to the rendered button
<script setup>
import { SignUpButton } from '@thunderid/vue'
</script>
<template>
<SignUpButton />
</template><SignedIn />The `SignedIn` component conditionally renders its default slot only when the user is authenticated with ThunderID. It checks the current authentication state and displays protected UI content for signed-in users. When the user is not authenticated, it renders an optional `#fallback` slot or nothing by default. This makes it ideal for guarding routes or UI sections that require authentication.
<script setup>
import { SignedIn } from '@thunderid/vue'
</script>
<template>
<SignedIn>
<p>Welcome! You are signed in.</p>
</SignedIn>
</template><SignedOut />The `SignedOut` component conditionally renders its default slot only when the user is not authenticated with ThunderID. It checks the current authentication state and displays content for unauthenticated users, while rendering an optional `#fallback` slot (or nothing by default) when the user is authenticated. This makes it ideal for showing sign-in prompts, public landing pages, or content that should only be visible to guests.
<script setup>
import { SignedOut, SignInButton } from '@thunderid/vue'
</script>
<template>
<SignedOut>
<div>
<h1>Welcome!</h1>
<SignInButton />
</div>
</SignedOut>
</template><User />The `User` component is a declarative way to access the authenticated user object from the ThunderID authentication context. It uses a scoped slot to expose the user data, making it easy to display user information or conditionally render UI based on authentication state.
<script setup>
import { User } from '@thunderid/vue'
</script>
<template>
<User>
<template #default="{ user }">
<div>
<h1>Welcome, {{ user.name }}!</h1>
<p>Email: {{ user.email }}</p>
</div>
</template>
<template #fallback>
<p>Please sign in</p>
</template>
</User>
</template><UserDropdown />The `UserDropdown` component renders an avatar button that opens a dropdown menu with user information and common actions like viewing the profile and signing out. You can insert additional menu items between the Profile link and Sign Out.
menuItemsoptionalDropdownMenuItem[]Extra items inserted between the Profile link and Sign Out
menuAlign'auto' \How the dropdown panel aligns relative to the trigger. Defaults to `'auto'`.
showChevronoptionalbooleanWhether to render the animated down-chevron beside the avatar. Defaults to `false`.
size'sm' \Dropdown density. Defaults to `'md'`.
classNameoptionalstringExtra CSS class added to the root element
<script setup>
import { UserDropdown } from '@thunderid/vue'
</script>
<template>
<header>
<UserDropdown />
</header>
</template><UserProfile />The `UserProfile` component renders a complete user profile management interface where users can view and edit their personal information.
titleoptionalstringCard header title. Defaults to `'Profile'`.
cardLayoutoptionalbooleanWhether to render inside a Card wrapper. Defaults to `true`.
cardVariant'elevated' \Shadow/border style of the card wrapper. Defaults to `'elevated'`.
compactoptionalbooleanTighter spacing, useful inside modals or dropdowns. Defaults to `false`.
editableoptionalbooleanWhether fields can be edited inline. Defaults to `true`.
showAvataroptionalbooleanWhether to render the avatar hero section. Defaults to `true`.
avatarSize'sm' \Avatar circle size. Defaults to `'lg'`.
showFieldsoptionalstring[]Fields to show. Empty means show all.
hideFieldsoptionalstring[]Fields to hide by name
classNameoptionalstringExtra CSS class added to the root element
<script setup>
import { UserProfile } from '@thunderid/vue'
</script>
<template>
<div>
<h1>My Profile</h1>
<UserProfile />
</div>
</template><ThunderIDProvider />The `ThunderIDProvider` is the root provider component that configures `@thunderid/vue` and provides ThunderID context to your entire Vue application. It must wrap your application to enable authentication features.
clientIdrequiredstringClient ID of your application
baseUrlrequiredstringThe base URL of the ThunderID instance (e.g., `https://localhost:8090`)
applicationIdoptionalstringThe ThunderID application ID
afterSignInUrloptionalstringURL to redirect to after sign-in completes. Defaults to `window.location.origin`.
afterSignOutUrloptionalstringURL to redirect to after sign-out completes. Defaults to `window.location.origin`.
scopesoptionalstring[]OpenID Connect Scopes to request during sign-in. Defaults to `'openid profile internal_login'` if not provided.
signInUrloptionalstringCustom sign-in URL. When set, `` navigates to this URL instead of triggering the embedded flow.
signUpUrloptionalstringCustom sign-up URL. When set, `` navigates to this URL instead of triggering the embedded flow.
signInOptionsoptionalSignInOptionsAdditional sign-in options forwarded to the underlying client.
storage'sessionStorage' \Storage mechanism for session management. Defaults to `sessionStorage`.
instanceIdoptionalnumberInstance ID for multi-instance support. Defaults to `0`.
organizationHandleoptionalstringThe organization handle.
organizationChainoptionalobjectOrganization chain configuration.
platformoptionalstringPlatform type. Use `'ThunderIDV2'` to enable V2 embedded flow features.
syncSessionoptionalbooleanWhether to sync sessions across tabs.
<template>
<ThunderIDProvider
client-id="<your-app-client-id>"
base-url="https://localhost:8090"
>
<router-view />
</ThunderIDProvider>
</template>