Skip to main content

API reference

The public surface of

@thunderid/vue, as documented in its reference pages.

hookuseThunderID()

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 ``.

Returns
isSignedIn
boolean

Whether the user is currently signed in

isLoading
boolean

Whether an authentication operation is in progress

user
User \

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

organization
Organization \

The current active organization

signIn
(...args) => Promise<User \

Initiates the sign-in flow

signOut
(...args) => Promise

Signs the current user out

signUp
(...args) => Promise

Initiates the sign-up flow

getAccessToken
() => Promise

Returns the current access token

getDecodedIdToken
() => Promise

Returns the decoded ID token payload

http
{ request, requestAll }

Authenticated HTTP client (see Accessing Protected APIs)

Example
<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>
component<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. :::

Props
attributeoptional
string

The credential attribute this instance manages, any attribute the user type schema declares `credential: true` for. Defaults to `'password'`.

cardLayoutoptional
boolean

Whether to wrap the form in a bordered card. Defaults to `false`.

classNameoptional
string

Additional CSS class added to the root element. Defaults to `''`.

policyoptional
PasswordPolicy

The rules the new value must satisfy. Defaults to the applicable rules from the user type schema.

preferencesoptional
Preferences

Component-level preference overrides, including i18n.

showRequirementsoptional
boolean

Whether to render the live requirement checklist. Defaults to `true`.

titleoptional
string

Overrides the default `"Change {credential}"` heading. Pass an empty string to omit the heading entirely. Defaults to a translated, schema-derived heading.

Example
<script setup>
import { ChangeCredential } from '@thunderid/vue'
</script>

<template>
  <div>
    <h2>Security</h2>
    <ChangeCredential />
  </div>
</template>
component<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.

Example
<script setup>
import { Loading } from '@thunderid/vue'
</script>

<template>
  <Loading>
    <div>Checking authentication...</div>
  </Loading>
</template>
component<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.

Props
signInOptionsoptional
Record

Sign-in options forwarded to the underlying client. Overrides any `signInOptions` set on ``.

classoptional
string

CSS class applied to the rendered button

style
string \

Inline styles applied to the rendered button

Example
<script setup>
import { SignInButton } from '@thunderid/vue'
</script>

<template>
  <SignInButton />
</template>
component<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.

Props
classoptional
string

CSS class applied to the rendered button

style
string \

Inline styles applied to the rendered button

Example
<script setup>
import { SignOutButton } from '@thunderid/vue'
</script>

<template>
  <SignOutButton />
</template>
component<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.

Props
classoptional
string

CSS class applied to the rendered button

style
string \

Inline styles applied to the rendered button

Example
<script setup>
import { SignUpButton } from '@thunderid/vue'
</script>

<template>
  <SignUpButton />
</template>
component<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.

Example
<script setup>
import { SignedIn } from '@thunderid/vue'
</script>

<template>
  <SignedIn>
    <p>Welcome! You are signed in.</p>
  </SignedIn>
</template>
component<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.

Example
<script setup>
import { SignedOut, SignInButton } from '@thunderid/vue'
</script>

<template>
  <SignedOut>
    <div>
      <h1>Welcome!</h1>
      <SignInButton />
    </div>
  </SignedOut>
</template>
component<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.

Example
<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>
component<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.

Props
menuItemsoptional
DropdownMenuItem[]

Extra items inserted between the Profile link and Sign Out

menuAlign
'auto' \

How the dropdown panel aligns relative to the trigger. Defaults to `'auto'`.

showChevronoptional
boolean

Whether to render the animated down-chevron beside the avatar. Defaults to `false`.

size
'sm' \

Dropdown density. Defaults to `'md'`.

classNameoptional
string

Extra CSS class added to the root element

Example
<script setup>
import { UserDropdown } from '@thunderid/vue'
</script>

<template>
  <header>
    <UserDropdown />
  </header>
</template>
component<UserProfile />

The `UserProfile` component renders a complete user profile management interface where users can view and edit their personal information.

Props
titleoptional
string

Card header title. Defaults to `'Profile'`.

cardLayoutoptional
boolean

Whether to render inside a Card wrapper. Defaults to `true`.

cardVariant
'elevated' \

Shadow/border style of the card wrapper. Defaults to `'elevated'`.

compactoptional
boolean

Tighter spacing, useful inside modals or dropdowns. Defaults to `false`.

editableoptional
boolean

Whether fields can be edited inline. Defaults to `true`.

showAvataroptional
boolean

Whether to render the avatar hero section. Defaults to `true`.

avatarSize
'sm' \

Avatar circle size. Defaults to `'lg'`.

showFieldsoptional
string[]

Fields to show. Empty means show all.

hideFieldsoptional
string[]

Fields to hide by name

classNameoptional
string

Extra CSS class added to the root element

Example
<script setup>
import { UserProfile } from '@thunderid/vue'
</script>

<template>
  <div>
    <h1>My Profile</h1>
    <UserProfile />
  </div>
</template>
export<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.

Props
clientIdrequired
string

Client ID of your application

baseUrlrequired
string

The base URL of the ThunderID instance (e.g., `https://localhost:8090`)

applicationIdoptional
string

The ThunderID application ID

afterSignInUrloptional
string

URL to redirect to after sign-in completes. Defaults to `window.location.origin`.

afterSignOutUrloptional
string

URL to redirect to after sign-out completes. Defaults to `window.location.origin`.

scopesoptional
string[]

OpenID Connect Scopes to request during sign-in. Defaults to `'openid profile internal_login'` if not provided.

signInUrloptional
string

Custom sign-in URL. When set, `` navigates to this URL instead of triggering the embedded flow.

signUpUrloptional
string

Custom sign-up URL. When set, `` navigates to this URL instead of triggering the embedded flow.

signInOptionsoptional
SignInOptions

Additional sign-in options forwarded to the underlying client.

storage
'sessionStorage' \

Storage mechanism for session management. Defaults to `sessionStorage`.

instanceIdoptional
number

Instance ID for multi-instance support. Defaults to `0`.

organizationHandleoptional
string

The organization handle.

organizationChainoptional
object

Organization chain configuration.

platformoptional
string

Platform type. Use `'ThunderIDV2'` to enable V2 embedded flow features.

syncSessionoptional
boolean

Whether to sync sessions across tabs.

Example
<template>
  <ThunderIDProvider
    client-id="<your-app-client-id>"
    base-url="https://localhost:8090"
  >
    <router-view />
  </ThunderIDProvider>
</template>
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.