Create Account
Create Account
Section titled “Create Account”Accounts are created automatically when users sign in. No manual setup is needed.
How Account Creation Works
Section titled “How Account Creation Works”When a user signs in through PrivyStack, Varity automatically:
- Authenticates the user via email or social login
- Creates a secure account linked to the user’s identity
- Manages account credentials — encrypted and recoverable, nothing for users to remember
Users see a familiar sign-in experience, just like any other modern app.
Displaying User Profile
Section titled “Displaying User Profile”Use the pre-built PrivyUserProfile component for a ready-made profile display:
import { PrivyUserProfile } from '@varity-labs/ui-kit';
function ProfilePage() { return ( <div> <h2>Your Profile</h2> <PrivyUserProfile /> </div> );}Accessing User Info
Section titled “Accessing User Info”After authentication, use usePrivy to access the current user’s details:
import { usePrivy } from '@varity-labs/ui-kit';
function AccountInfo() { const { authenticated, user, ready } = usePrivy();
if (!ready) return <p>Loading...</p>; if (!authenticated) return <p>Please sign in first</p>;
return ( <div> <p>User ID: {user?.id}</p> <p>Email: {user?.email?.address || 'Not provided'}</p> <p>Name: {user?.google?.name || user?.twitter?.name || 'Not provided'}</p> </div> );}Authentication Methods
Section titled “Authentication Methods”Users can create accounts through any supported login method:
| Method | Description |
|---|---|
| Magic link sent to email, no password needed | |
| Sign in via Google account | |
| Sign in via Twitter/X account | |
| Discord | Sign in via Discord account |
| GitHub | Sign in via GitHub account |
All methods result in a secure account being created automatically.
Checking Authentication State
Section titled “Checking Authentication State”import { usePrivy } from '@varity-labs/ui-kit';
function AuthGate({ children }) { const { ready, authenticated } = usePrivy();
if (!ready) { return <p>Initializing...</p>; }
if (!authenticated) { return <p>Please sign in to continue.</p>; }
return <>{children}</>;}Signing Out
Section titled “Signing Out”import { useLogout } from '@varity-labs/ui-kit';
function SignOutButton() { const { logout } = useLogout();
return <button onClick={logout}>Sign Out</button>;}Advanced: Account Infrastructure
Varity automatically manages account infrastructure. For advanced use cases, see Session Keys.
Next steps
Section titled “Next steps”- Accounts Quick Start — Overview of accounts
- Session Keys — Advanced operation patterns
- Authentication Quick Start — Set up login