Skip to main content

Overview

You're reading Identity & Access Management 7.0.0. The newest release is 7.3.0, and Cloud has the newest features. Go to the newest release

The WSO2 Identity Server Nuxt SDK (@asgardeo/nuxt) is a Nuxt module that adds authentication, user self-care, and organization management to Nuxt applications. It runs the OAuth 2.0 authorization code flow on the server, keeps the session in a signed, HTTP-only cookie, and gives your pages ready-made components and composables.

When you add the module to nuxt.config.ts, it:

  • Registers server API routes under /api/auth/* that handle sign-in, the OAuth callback, sign-out, tokens, the user profile, organizations, and branding.
  • Resolves the session and prefetches the user, profile, organizations, and branding on every server-rendered page request, then hydrates that state on the client.
  • Auto-registers <AsgardeoRoot> and the UI components with an Asgardeo prefix, such as <AsgardeoSignedIn> and <AsgardeoSignInButton>.
  • Auto-imports composables such as useAsgardeo(), useUser(), and useOrganization().
  • Registers a named route middleware, auth, that protects pages.

Installation​

Use one of the following options to install the WSO2 Identity Server Nuxt SDK.

npm install @asgardeo/nuxt

Then add the module to nuxt.config.ts:

nuxt.config.ts
export default defineNuxtConfig({
modules: ['@asgardeo/nuxt'],
});

Getting started​

Try out the WSO2 Identity Server Nuxt quickstart guide.

Configuration​

  • Module configuration – The asgardeo options in nuxt.config.ts and the environment variables the module reads.

Root component​

  • <AsgardeoRoot> – Wraps your app in app.vue and supplies the user, organization, theme, branding, flow, and i18n contexts that the components and composables read.

Components​

All components are auto-registered. Use them in any <template> without importing them.

Action components​

Control components​

Authentication components​

User self-care components​

Organization components (B2B)​

Composables​

All composables are auto-imported.

  • useAsgardeo() – Authentication state and the sign-in, sign-out, sign-up, and access token methods.
  • useUser() – The user's SCIM2 profile and methods to update and refresh it.
  • useOrganization() – The current organization, the user's organizations, and organization switching.
  • useTheme() – The resolved theme and color scheme.
  • useBranding() – The organization's branding preference.
  • useAsgardeoI18n() – Translations and the current language of the SDK's UI.
  • useFlow() – UI state of the embedded authentication flows.
  • useFlowMeta() – Flow metadata used by the embedded authentication flows.

Route protection​

Server​

  • Server API routes – The /api/auth/* routes that the module registers.
  • Server utilities – Helpers from @asgardeo/nuxt/server for your own server routes, such as requireServerSession() and getValidAccessToken().

Guides​

Was this page helpful?