Skip to main content

useOrganization()

The useOrganization composable returns the currently active organization object as a reactive computed ref. It is auto-imported and available everywhere without an explicit import.

Usage

pages/dashboard.vue
<script setup lang="ts">
const organization = useOrganization()
</script>

<template>
<div v-if="organization">
<h1>{{ organization.name }}</h1>
<p>Organization ID: {{ organization.id }}</p>
</div>
<p v-else>No organization selected.</p>
</template>

Return Value

useOrganization() returns a ComputedRef<Organization | null>. The value is null when the user is not signed in or has no active organization.

Organization Object

PropertyTypeDescription
idstringThe organization's unique identifier
namestringThe organization's display name
refstring | nullAn optional external reference identifier

Notes

  • This composable is re-exported from @thunderid/vue and behaves identically in Nuxt.
  • On SSR-rendered pages, the organization value is hydrated from the server session when preferences.user.fetchOrganizations is enabled.
  • To switch organizations, use the <ThunderIDOrganizationSwitcher /> component or call the /api/auth/organizations/switch route directly.
ThunderID LogoThunderID Logo

Product

DocsAPIsSDKs
© WSO2 LLC. All rights reserved.Privacy PolicyCookie Policy