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
fetchTokenonce 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
fetchTokenis disposed - Re-applies auth when the client reconnects
Related renderless components
The root package also exports:
ConvexAuthenticatedConvexUnauthenticatedConvexAuthLoading
These components are client-only and read from the same shared auth state.