The @ave-id/sdk/next module provides client components for the App Router: AveSessionProvider, useAveSession, and optional AveConvexBridge.
Install
react is a peer dependency (18+).
App layout: session + Convex
AveSessionProvider must run in a client bundle. Keep a small Providers component and import it from layout.tsx.
OAuth callback route
Use completeOAuthCallback from @ave-id/sdk/client in a client page (or call finishPkceLogin + session.setTokensFromResponse). The provider’s AveSession instance must be the same one — obtain it via useAveSession().session in a child component, or structure your callback as a component under AveSessionProvider and pass session from context.
Example: a /callback page that mounts only after login redirect can use useAveSession to run completeOAuthCallback once when searchParams.code is present.
Hooks
useAveSession() — { session, status, snapshot, isHydrated }. Wait for isHydrated before treating status === "signedOut" as definitive on first paint.
getAppKeyBase64() on session for E2EE after hydrate.
Last modified on May 1, 2026