API Reference

useConvexAuth

Reference for the shared auth-state composable and related renderless components.

useConvexAuth configures token fetching for the shared runtime and exposes the current auth state.

Import

Nuxt
const { isLoading, isAuthenticated } = useConvexAuth()
Vue
import { useConvexAuth } from 'vue-convex'

Signature

function useConvexAuth(options?: {
  fetchToken?: AuthTokenFetcher
}): {
  isLoading: ComputedRef<boolean>
  isAuthenticated: ComputedRef<boolean>
}

Behavior

  • Call with fetchToken once near the root to configure auth
  • Call without options in descendant components to read the shared state
  • Resets auth state when the scope that configured fetchToken is disposed
  • Re-applies auth when the client reconnects

The root package also exports:

  • ConvexAuthenticated
  • ConvexUnauthenticated
  • ConvexAuthLoading

These components are client-only and read from the same shared auth state.

Copyright © 2026