Skip to content

Accounts Quick Start

Varity Team Core Contributors Updated March 2026

When users sign in to your Varity app, they automatically get a fully capable account. No extra setup needed.

  • A Varity project with authentication set up (Auth Quick Start)
  • Node.js 18 or later

When a user logs in via PrivyStack, Varity automatically:

  1. Authenticates the user via email or social login
  2. Creates a secure account linked to their identity
  3. Enables all app capabilities (payments, storage, etc.)
  4. Sets up session handling

You don’t need to configure anything extra — PrivyStack handles everything.

Use the usePrivy hook to check if a user is signed in and access their account info:

src/components/AccountStatus.tsx
import { usePrivy } from '@varity-labs/ui-kit';
function AccountStatus() {
const { authenticated, user, ready } = usePrivy();
if (!ready) return <p>Loading...</p>;
if (!authenticated) return <p>Not signed in</p>;
return (
<div>
<p>Signed in as: {user?.email?.address || 'User'}</p>
<p>Account active</p>
</div>
);
}

Show content only to signed-in users:

src/components/ProtectedDashboard.tsx
import { PrivyProtectedRoute } from '@varity-labs/ui-kit';
function App() {
return (
<PrivyProtectedRoute>
<Dashboard />
</PrivyProtectedRoute>
);
}

You can also check authentication status programmatically:

src/components/ConditionalContent.tsx
import { usePrivy } from '@varity-labs/ui-kit';
function ConditionalContent() {
const { authenticated, login } = usePrivy();
if (!authenticated) {
return <button onClick={login}>Sign in to continue</button>;
}
return <p>Welcome back! Your account is ready.</p>;
}
Advanced: Account Infrastructure

Behind the scenes, Varity handles all account infrastructure automatically. When a user signs in, a secure account is created and configured with all capabilities enabled by default — including sponsored operations so users never see unexpected fees.

No configuration is required. Advanced users who need lower-level access to account features can see Session Keys for details.

All of the following are exported from @varity-labs/ui-kit:

ExportTypeDescription
PrivyStackComponentWraps your app with authentication
VarityPrivyProviderComponentLower-level auth provider
PrivyLoginButtonComponentPre-built sign-in button
PrivyUserProfileComponentDisplays user profile info
PrivyProtectedRouteComponentProtects routes from unauthenticated access
PrivyReadyGateComponentRenders children only after auth initializes
usePrivyHookAccess auth state, user data, login/logout
useWalletsHookAccess connected accounts
useLoginHookProgrammatic login
useLogoutHookProgrammatic logout