This library is in early development. Expect breaking changes.
Getting Started

Client Setup

Configure the client-side authentication client.

Create the Client Factory

Create app/auth.config.ts and export a createAppAuthClient function.

This factory function exists because the module needs to inject the correct baseURL at runtime. The module calls this function and provides the URL automatically.
app/auth.config.ts
import { createAuthClient } from 'better-auth/vue'

export function createAppAuthClient(baseURL: string) {
  return createAuthClient({ baseURL })
  //     ^?
}

Using Plugins

If you added a plugin in your server config (server/auth.config.ts), make sure to add its client equivalent here.

app/auth.config.ts
import { createAuthClient } from 'better-auth/vue'
import { adminClient } from 'better-auth/client/plugins'

export function createAppAuthClient(baseURL: string) {
  return createAuthClient({
    baseURL,
    plugins: [
      adminClient() // Must match the server plugin
    ]
  })
}

Common Plugin Combinations

Admin + Two Factor

app/auth.config.ts
import { createAuthClient } from 'better-auth/vue'
import { adminClient, twoFactorClient } from 'better-auth/client/plugins'

export function createAppAuthClient(baseURL: string) {
  return createAuthClient({
    baseURL,
    plugins: [adminClient(), twoFactorClient()]
  })
}
Learn how to enable Type Augmentation for full type safety.