---
title: "better-auth/client"
description: "Public client-side API for the opt-in Better Auth integration — a Vue/Nuxt port of @convex-dev/better-auth's react integration."
canonical_url: "https://nuxt-convex-module.dev/api-reference/reference/better-auth/client"
---
# better-auth/client

Public client-side API for the opt-in Better Auth integration — a Vue/Nuxt
port of `@convex-dev/better-auth`'s `react` integration.

## Interfaces

### ConsumeCrossDomainOneTimeTokenOptions

Defined in: [src/runtime/better-auth/vue/cross-domain.ts:26](https://github.com/qruto/nuxt-convex-module/blob/main/src/runtime/better-auth/vue/cross-domain.ts#L26)

Options for [consumeCrossDomainOneTimeToken](#consumecrossdomainonetimetoken).

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="callbackroute">
        
      </a>
      
       <code>
        callbackRoute?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Only exchange the one-time token when the page URL matches this route (e.g. <code>
        '/auth/callback'
      </code>
      
      ; trailing slashes ignored). On every other route the <code>
        ott
      </code>
      
       parameter is scrubbed from the URL but <strong>
        not
      </strong>
      
       exchanged. The cross-domain protocol cannot bind the token to the browser that started the sign-in flow (magic-link flows legitimately finish in another browsing context), so without this restriction a token completes sign-in on whatever page receives it. Restricting consumption to the one route your sign-in <code>
        callbackURL
      </code>
      
      s point at keeps that to a single predictable URL. In Nuxt, set <code>
        convex.betterAuth.crossDomainCallbackRoute
      </code>
      
       instead — the client plugin forwards it here.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-convex-module/blob/main/src/runtime/better-auth/vue/cross-domain.ts#L42" rel="nofollow">
        src/runtime/better-auth/vue/cross-domain.ts:42
      </a>
    </td>
  </tr>
</tbody>
</table>

---

### UseBetterAuthReturn

Defined in: [src/runtime/better-auth/vue/use-better-auth.ts:40](https://github.com/qruto/nuxt-convex-module/blob/main/src/runtime/better-auth/vue/use-better-auth.ts#L40)

What `useBetterAuth()` returns.

#### Properties

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a id="isloading">
        
      </a>
      
       <code>
        isLoading
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      <code>
        true
      </code>
      
       until the session is known and no prefetched token covers the gap.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-convex-module/blob/main/src/runtime/better-auth/vue/use-better-auth.ts#L43" rel="nofollow">
        src/runtime/better-auth/vue/use-better-auth.ts:43
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="isauthenticated">
        
      </a>
      
       <code>
        isAuthenticated
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        boolean
      </code>
      
      >
    </td>
    
    <td>
      <code>
        true
      </code>
      
       when Better Auth reports a session, or a token is cached while it reloads.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-convex-module/blob/main/src/runtime/better-auth/vue/use-better-auth.ts#L45" rel="nofollow">
        src/runtime/better-auth/vue/use-better-auth.ts:45
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="fetchaccesstoken">
        
      </a>
      
       <code>
        fetchAccessToken
      </code>
    </td>
    
    <td>
      <a href="https://nuxt-convex-module.dev/api-reference/reference/client#authtokenfetcher">
        <code>
          AuthTokenFetcher
        </code>
      </a>
    </td>
    
    <td>
      Convex's token fetcher: the Better Auth JWT for the current session, or <code>
        null
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-convex-module/blob/main/src/runtime/better-auth/vue/use-better-auth.ts#L47" rel="nofollow">
        src/runtime/better-auth/vue/use-better-auth.ts:47
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="client">
        
      </a>
      
       <code>
        client
      </code>
    </td>
    
    <td>
      <code>
        VueAuthClient
      </code>
    </td>
    
    <td>
      The Better Auth client from <code>
        #convex/auth-client
      </code>
      
       — sign-in, sign-out and every plugin flow live here.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-convex-module/blob/main/src/runtime/better-auth/vue/use-better-auth.ts#L52" rel="nofollow">
        src/runtime/better-auth/vue/use-better-auth.ts:52
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="session">
        
      </a>
      
       <code>
        session
      </code>
    </td>
    
    <td>
      <a href="#betterauthsession">
        <code>
          BetterAuthSession
        </code>
      </a>
    </td>
    
    <td>
      Better Auth's own <code>
        useSession()
      </code>
      
       ref: <code>
        { data, isPending, error }
      </code>
      
      .
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-convex-module/blob/main/src/runtime/better-auth/vue/use-better-auth.ts#L54" rel="nofollow">
        src/runtime/better-auth/vue/use-better-auth.ts:54
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="user">
        
      </a>
      
       <code>
        user
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<a href="#betterauthuser">
        <code>
          BetterAuthUser
        </code>
      </a>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      The current user, or <code>
        null
      </code>
      
       when signed out / still loading.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-convex-module/blob/main/src/runtime/better-auth/vue/use-better-auth.ts#L56" rel="nofollow">
        src/runtime/better-auth/vue/use-better-auth.ts:56
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <a id="authversion">
        
      </a>
      
       <code>
        authVersion
      </code>
    </td>
    
    <td>
      <code>
        ComputedRef
      </code>
      
      <<code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      >
    </td>
    
    <td>
      The session id (or user id); changes when the signed-in identity changes.
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-convex-module/blob/main/src/runtime/better-auth/vue/use-better-auth.ts#L58" rel="nofollow">
        src/runtime/better-auth/vue/use-better-auth.ts:58
      </a>
    </td>
  </tr>
</tbody>
</table>

## Type Aliases

### AuthClient

```ts
type AuthClient = typeof authClient;
```

Defined in: [src/runtime/better-auth/vue/client.ts:24](https://github.com/qruto/nuxt-convex-module/blob/main/src/runtime/better-auth/vue/client.ts#L24)

---

### BetterAuthSession

```ts
type BetterAuthSession = AuthClient["useSession"] extends {
  (): R;
  (useFetch): any;
} ? R : never;
```

Defined in: [src/runtime/better-auth/vue/use-better-auth.ts:34](https://github.com/qruto/nuxt-convex-module/blob/main/src/runtime/better-auth/vue/use-better-auth.ts#L34)

---

### BetterAuthUser

```ts
type BetterAuthUser = {
  id: string;
  email: string;
  name: string;
} & Record<string, unknown>;
```

Defined in: [src/runtime/better-auth/vue/use-better-auth.ts:37](https://github.com/qruto/nuxt-convex-module/blob/main/src/runtime/better-auth/vue/use-better-auth.ts#L37)

The signed-in user (loose — exact fields depend on your auth schema).

#### Type Declaration

<table>
<thead>
  <tr>
    <th>
      Name
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-convex-module/blob/main/src/runtime/better-auth/vue/use-better-auth.ts#L37" rel="nofollow">
        src/runtime/better-auth/vue/use-better-auth.ts:37
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        email
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-convex-module/blob/main/src/runtime/better-auth/vue/use-better-auth.ts#L37" rel="nofollow">
        src/runtime/better-auth/vue/use-better-auth.ts:37
      </a>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <a href="https://github.com/qruto/nuxt-convex-module/blob/main/src/runtime/better-auth/vue/use-better-auth.ts#L37" rel="nofollow">
        src/runtime/better-auth/vue/use-better-auth.ts:37
      </a>
    </td>
  </tr>
</tbody>
</table>

## Variables

### convexClient

```ts
const convexClient: () => {
  id: "convex";
  version: string;
  $InferServerPlugin: ReturnType<typeof convex>;
};
```

Defined in: node_modules/@convex-dev/better-auth/dist/plugins/convex/client.d.ts:2

#### Returns

```ts
{
  id: "convex";
  version: string;
  $InferServerPlugin: ReturnType<typeof convex>;
}
```

<table>
<thead>
  <tr>
    <th>
      Name
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Defined in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        "convex"
      </code>
    </td>
    
    <td>
      node_modules/@convex-dev/better-auth/dist/plugins/convex/client.d.ts:3
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        version
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      node_modules/@convex-dev/better-auth/dist/plugins/convex/client.d.ts:4
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        $InferServerPlugin
      </code>
    </td>
    
    <td>
      <code>
        ReturnType
      </code>
      
      <<em>
        typeof
      </em>
      
       <code>
        convex
      </code>
      
      >
    </td>
    
    <td>
      node_modules/@convex-dev/better-auth/dist/plugins/convex/client.d.ts:5
    </td>
  </tr>
</tbody>
</table>

---

### crossDomainClient

```ts
const crossDomainClient: (opts?) => CrossDomainClientPlugin;
```

Defined in: node_modules/@convex-dev/better-auth/dist/plugins/cross-domain/client.d.ts:14

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        opts?
      </code>
    </td>
    
    <td>
      { <code>
        storage?
      </code>
      
      : { <code>
        setItem
      </code>
      
      : (<code>
        key
      </code>
      
      , <code>
        value
      </code>
      
      ) => <code>
        any
      </code>
      
      ; <code>
        getItem
      </code>
      
      : (<code>
        key
      </code>
      
      ) => <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; }; <code>
        storagePrefix?
      </code>
      
      : <code>
        string
      </code>
      
      ; <code>
        disableCache?
      </code>
      
      : <code>
        boolean
      </code>
      
      ; }
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        opts.storage?
      </code>
    </td>
    
    <td>
      { <code>
        setItem
      </code>
      
      : (<code>
        key
      </code>
      
      , <code>
        value
      </code>
      
      ) => <code>
        any
      </code>
      
      ; <code>
        getItem
      </code>
      
      : (<code>
        key
      </code>
      
      ) => <code>
        string
      </code>
      
       | <code>
        null
      </code>
      
      ; }
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        opts.storage.setItem?
      </code>
    </td>
    
    <td>
      (<code>
        key
      </code>
      
      , <code>
        value
      </code>
      
      ) => <code>
        any
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        opts.storage.getItem?
      </code>
    </td>
    
    <td>
      (<code>
        key
      </code>
      
      ) => <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        opts.storagePrefix?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        opts.disableCache?
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
  </tr>
</tbody>
</table>

#### Returns

`CrossDomainClientPlugin`

---

### AuthBoundary

```ts
const AuthBoundary: DefineComponent<ExtractPropTypes<{
  onUnauth: {
     type: PropType<() => void | Promise<void>>;
     required: true;
  };
  authClient: {
     type: PropType<VueAuthClient<{
        plugins: {
           id: "convex";
           version: string;
           $InferServerPlugin: {
              id: "convex";
              version: string;
              init: (ctx) => ...;
              hooks: {
                 before: ...;
                 after: ...;
              };
              endpoints: {
                 getOpenIdConfig: ...;
                 getJwks: ...;
                 getLatestJwks: ...;
                 rotateKeys: ...;
                 getToken: ...;
              };
              schema: {
                 jwks: ...;
                 user: ...;
              };
           };
        }[];
     }>>;
     required: true;
  };
  renderFallback: {
     type: PropType<() => 
        | VNode<RendererNode, RendererElement, {
      [key: string]: any;
      }>
       | null>;
     default: () => null;
  };
  getAuthUserFn: {
     type: PropType<FunctionReference<"query", "public", EmptyObject>>;
     required: true;
  };
  isAuthError: {
     type: PropType<(error) => boolean>;
     required: true;
  };
}>, () => 
  | VNode<RendererNode, RendererElement, {
[key: string]: any;
}>
  | (
  | VNode<RendererNode, RendererElement, {
[key: string]: any;
}>
  | VNode<RendererNode, RendererElement, {
[key: string]: any;
}>[]
  | undefined)[]
  | null, {
}, {
}, {
}, ComponentOptionsMixin, ComponentOptionsMixin, {
}, string, PublicProps, ToResolvedProps<ExtractPropTypes<{
  onUnauth: {
     type: PropType<() => void | Promise<void>>;
     required: true;
  };
  authClient: {
     type: PropType<VueAuthClient<{
        plugins: {
           id: "convex";
           version: string;
           $InferServerPlugin: {
              id: ...;
              version: ...;
              init: ...;
              hooks: ...;
              endpoints: ...;
              schema: ...;
           };
        }[];
     }>>;
     required: true;
  };
  renderFallback: {
     type: PropType<() => 
        | VNode<RendererNode, RendererElement, {
      [key: string]: any;
      }>
       | null>;
     default: () => null;
  };
  getAuthUserFn: {
     type: PropType<FunctionReference<"query", "public", EmptyObject>>;
     required: true;
  };
  isAuthError: {
     type: PropType<(error) => boolean>;
     required: true;
  };
}>, {
}>, {
  renderFallback: () => 
     | VNode<RendererNode, RendererElement, {
   [key: string]: any;
   }>
    | null;
}, {
}, {
}, {
}, string, ComponentProvideOptions, true, {
}, any>;
```

Defined in: [src/runtime/better-auth/vue/auth-boundary.ts:83](https://github.com/qruto/nuxt-convex-module/blob/main/src/runtime/better-auth/vue/auth-boundary.ts#L83)

**Experimental**

*Experimental*

A wrapper Vue component which provides error handling for auth related errors.
This is typically used to redirect the user to the login page when they are
unauthenticated, and does so reactively based on the getAuthUserFn query.

#### Example

```vue
<!--
  convex/auth.ts:
  export const { getAuthUser } = authComponent.clientApi();
-->
<script setup lang="ts">
import { AuthBoundary, authClient } from '#imports'
import { api } from '#convex/api'
import { isAuthError } from '~/utils/auth'
</script>

<template>
  <AuthBoundary
    :on-unauth="() => navigateTo('/sign-in')"
    :auth-client="authClient"
    :get-auth-user-fn="api.auth.getAuthUser"
    :is-auth-error="isAuthError"
  >
    <slot />
  </AuthBoundary>
</template>
```

#### Param

**props.onUnauth**

Function to call when the user is
unauthenticated. Typically a redirect to the login page.

#### Param

**props.authClient**

Better Auth authClient to use.

#### Param

**props.renderFallback**

Fallback component to render when the user is
unauthenticated. Defaults to null. Generally not rendered as error handling
is typically a redirect.

#### Param

**props.getAuthUserFn**

Reference to a Convex query that returns user.
The component provides a query for this via `export const { getAuthUser } = authComponent.clientApi()`.

#### Param

**props.isAuthError**

Function to check if the error is auth related.

May change in a minor release — see STABILITY.md.

---

### authClient

```ts
const authClient: ReturnType<typeof createAuthClient>;
```

Defined in: [src/runtime/better-auth/vue/client.ts:15](https://github.com/qruto/nuxt-convex-module/blob/main/src/runtime/better-auth/vue/client.ts#L15)

## Functions

### consumeCrossDomainOneTimeToken()

```ts
function consumeCrossDomainOneTimeToken(options?): Promise<void>;
```

Defined in: [src/runtime/better-auth/vue/cross-domain.ts:71](https://github.com/qruto/nuxt-convex-module/blob/main/src/runtime/better-auth/vue/cross-domain.ts#L71)

Exchange a `?ott=...` one-time token (set by the Better Auth cross-domain
plugin when redirecting from an auth origin) for a full session — the Vue
port of `ConvexBetterAuthProvider`'s one-time-token `useEffect`.

Safe to call unconditionally — returns early when the URL has no `ott`
parameter or the cross-domain plugin is not installed on the auth client.

The token is not bound to the browser that initiated sign-in (upstream
design), so anyone holding a fresh token can mint a link that logs its
visitor into *their* session — see
[ConsumeCrossDomainOneTimeTokenOptions.callbackRoute](#callbackroute) for the
mitigation.

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        options
      </code>
    </td>
    
    <td>
      <a href="#consumecrossdomainonetimetokenoptions">
        <code>
          ConsumeCrossDomainOneTimeTokenOptions
        </code>
      </a>
    </td>
  </tr>
</tbody>
</table>

#### Returns

`Promise`<`void`>

---

### usePreloadedAuthQuery()

```ts
function usePreloadedAuthQuery<Query>(preloadedQuery): ComputedRef<Query["_returnType"] | null | undefined>;
```

Defined in: [src/runtime/better-auth/vue/hydration.ts:65](https://github.com/qruto/nuxt-convex-module/blob/main/src/runtime/better-auth/vue/hydration.ts#L65)

Auth-aware version of [usePreloadedQuery](https://nuxt-convex-module.dev/api-reference/reference/client#usepreloadedquery) for payloads returned by
`convexAuth(event).preloadAuthQuery(...)`.

A Vue/Nuxt port of `@convex-dev/better-auth`'s `usePreloadedAuthQuery`
(`src/nextjs/client.tsx`): show the preloaded server result until the preload
"expires" — i.e. auth settles as unauthenticated, or a live authenticated
result arrives — then follow the live query. The last committed value is held
while auth is (re)loading so a transient loading state does not flash the
(possibly stale) preloaded value. At runtime yields `undefined` for
unauthenticated users (as upstream does); the declared type also includes
`null` so code annotated against upstream's `| null` signature keeps
compiling.

#### Type Parameters

<table>
<thead>
  <tr>
    <th>
      Type Parameter
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        Query
      </code>
      
       <em>
        extends
      </em>
      
       <a href="https://nuxt-convex-module.dev/api-reference/reference/client#functionreference">
        <code>
          FunctionReference
        </code>
      </a>
      
      <<code>
        "query"
      </code>
      
      >
    </td>
  </tr>
</tbody>
</table>

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        preloadedQuery
      </code>
    </td>
    
    <td>
      <code>
        MaybeRefOrGetter
      </code>
      
      <<a href="https://nuxt-convex-module.dev/api-reference/reference/client#preloaded">
        <code>
          Preloaded
        </code>
      </a>
      
      <<code>
        Query
      </code>
      
      >>
    </td>
  </tr>
</tbody>
</table>

#### Returns

`ComputedRef`<`Query`[`"_returnType"`] | `null` | `undefined`>

---

### resolveAuthRedirect()

```ts
function resolveAuthRedirect(value, fallback?): string;
```

Defined in: [src/runtime/better-auth/vue/redirect.ts:53](https://github.com/qruto/nuxt-convex-module/blob/main/src/runtime/better-auth/vue/redirect.ts#L53)

Validate a post-sign-in redirect destination, returning `fallback` unless it
is a same-origin path.

Use it wherever a login page consumes the `?redirect=` query the `auth`
middleware sets — never navigate to that value directly.

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Default value
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        value
      </code>
    </td>
    
    <td>
      <code>
        unknown
      </code>
    </td>
    
    <td>
      <code>
        undefined
      </code>
    </td>
    
    <td>
      Candidate destination, typically <code>
        route.query.redirect
      </code>
      
      . A repeated query parameter arrives as an array and is rejected: which entry the app meant is ambiguous, and an attacker chooses the other one.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        fallback
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        '/'
      </code>
    </td>
    
    <td>
      Where to send the visitor when <code>
        value
      </code>
      
       is not a safe same-origin path. Defaults to <code>
        /
      </code>
      
      , and is returned as given — pass a path you control, not user input.
    </td>
  </tr>
</tbody>
</table>

#### Returns

`string`

The normalized `pathname + search + hash`, or `fallback`.

#### Example

```vue
<script setup lang="ts">
const route = useRoute()
const { client } = useBetterAuth()

async function onSubmit() {
  await client.signIn.email({ email, password })
  // '/dashboard' survives; 'https://evil.example' becomes '/'.
  await navigateTo(resolveAuthRedirect(route.query.redirect))
}
</script>
```

---

### useBetterAuth()

```ts
function useBetterAuth(initialToken?): UseBetterAuthReturn;
```

Defined in: [src/runtime/better-auth/vue/use-better-auth.ts:81](https://github.com/qruto/nuxt-convex-module/blob/main/src/runtime/better-auth/vue/use-better-auth.ts#L81)

The Better Auth service for the Vue/Nuxt runtime.

Returns the full Better Auth client, the reactive session wrapper, and the
Convex-compatible auth state used by the packaged auth plugin.

#### Parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        initialToken?
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
      
       | <code>
        null
      </code>
    </td>
    
    <td>
      Optional preloaded token, used once per app lifetime to avoid a round-trip on initial load (e.g. from SSR).
    </td>
  </tr>
</tbody>
</table>

#### Returns

[`UseBetterAuthReturn`](#usebetterauthreturn)

#### Example

```vue
<script setup lang="ts">
const { user, client, isAuthenticated } = useBetterAuth()

const signOut = () => client.signOut()
</script>
```


## Sitemap

See the full [sitemap](https://nuxt-convex-module.dev/sitemap.md) for all pages.
