Skip to content

<AsgardeoSignOutButton />

<AsgardeoSignOutButton> renders a button that signs the user out with the WSO2 Identity Server Nuxt SDK (@asgardeo/nuxt).

Overview

When the user clicks the button, it calls useAsgardeo().signOut(), which:

  1. Sends a POST request to /api/auth/signout.
  2. The server clears the session cookies and returns the WSO2 Identity Server sign-out URL.
  3. The browser navigates to that URL. WSO2 Identity Server ends the session and redirects the user to afterSignOutUrl.

If the user has no valid session, or the server can't build the sign-out URL, the server still clears the cookies and the browser navigates to afterSignOutUrl directly.

Usage

The component is auto-registered, so you don't need to import it.

Basic usage

<template>
  <AsgardeoSignedIn>
    <AsgardeoSignOutButton />
  </AsgardeoSignedIn>
</template>

Without slot content, the button shows the text Sign Out.

Custom content

<template>
  <AsgardeoSignOutButton class="btn btn-secondary">
    <template #default="{ isLoading }">
      {{ isLoading ? 'Signing out…' : 'Log out' }}
    </template>
  </AsgardeoSignOutButton>
</template>

Props

<AsgardeoSignOutButton> has no props. The class and style attributes are applied to the button.

Slots

Slot Slot props Description
default { isLoading: boolean } Button content. Defaults to Sign Out.

Events

Event Payload Description
click MouseEvent Emitted after sign-out starts the navigation.
error unknown Emitted when sign-out fails.