Skip to main content

๐ŸŽจ PasskeymeAuthPanel

PasskeymeAuthPanel is the all-in-one inline authentication solution for React applications. It provides a complete authentication experience with passkeys, OAuth providers, and optional password support - all embedded directly in your application with zero redirects.

โœจ Why PasskeymeAuthPanel?โ€‹

  • ๐Ÿ  Inline Authentication - No redirects, users stay in your app
  • ๐ŸŽจ Fully Customizable - Match your brand with theming and styling
  • โšก Zero Configuration - Works out of the box with sensible defaults
  • ๐Ÿ” Multiple Auth Methods - Passkeys, OAuth, and password in one component
  • ๐Ÿ“ฑ Mobile Optimized - Touch-friendly with biometric support
  • ๐ŸŽฏ TypeScript Ready - Full type safety and IntelliSense

๐Ÿš€ Quick Startโ€‹

import { PasskeymeAuthPanel } from '@passkeyme/react-auth';

function LoginPage() {
const handleAuthSuccess = (user, method) => {
console.log(`User authenticated via ${method}:`, user);
// Redirect to dashboard, store user state, etc.
};

const handleError = (error) => {
console.error('Authentication failed:', error);
};

const handleProviderSelect = (provider) => {
console.log(`Provider selected: ${provider}`);
};

return (
<div className="login-container">
<h1>Welcome Back</h1>
<PasskeymeAuthPanel
providers={["google", "github"]}
enablePasskeys={true}
layout="vertical"
spacing="normal"
title="Welcome to Passkeyme"
subtitle="Experience seamless authentication"
passkeyButtonText="๐Ÿš€ Sign in with Passkey"
dividerText="or choose your provider"
autoTriggerPasskey={false}
passkeyFirst={true}
hideProvidersInitially={false}
debugMode={false}
showDebugInfo={false}
onSuccess={handleAuthSuccess}
onError={handleError}
onProviderSelect={handleProviderSelect}
onPasskeyAttempt={() => console.log('Passkey attempt started')}
onOAuthRequired={(providers) => console.log('OAuth required:', providers)}
onLogout={() => console.log('User logged out')}
/>
</div>
);
}

๐Ÿ“‹ Props Referenceโ€‹

Required Propsโ€‹

PropTypeDescription
appIdstringYour Passkeyme application ID

Event Handlersโ€‹

PropTypeDescription
onSuccess(user: User, method: string) => voidCalled when authentication succeeds
onError(error: Error) => voidCalled when authentication fails
onProviderSelect(provider: string) => voidCalled when user selects OAuth provider
onPasskeyAttempt() => voidCalled when passkey authentication starts
onOAuthRequired(providers: string[]) => voidCalled when OAuth fallback is needed
onLogout() => voidCalled when user logs out

Authentication Configurationโ€‹

PropTypeDefaultDescription
providersstring[]['google', 'github']Enabled OAuth providers
enablePasskeysbooleantrueEnable passkey authentication
autoTriggerPasskeybooleanfalseAutomatically trigger passkey on load
passkeyFirstbooleantrueShow passkey button first
hideProvidersInitiallybooleanfalseHide OAuth providers initially

UI Configurationโ€‹

PropTypeDefaultDescription
themePasskeymeAuthPanelTheme{}Custom theme object (see theming section)
layout'vertical' | 'horizontal' | 'grid''vertical'Button layout
spacing'compact' | 'normal' | 'relaxed''normal'Spacing between elements
classNamestring-CSS class for container
styleReact.CSSProperties-Inline styles for container

Content Configurationโ€‹

PropTypeDefaultDescription
titlestring'Welcome to Passkeyme'Panel title
subtitlestring'Experience seamless authentication'Panel subtitle
passkeyButtonTextstring'๐Ÿš€ Sign in with Passkey'Passkey button text
dividerTextstring'or choose your provider'Divider text between auth methods

Advanced Optionsโ€‹

PropTypeDefaultDescription
debugModebooleanfalseEnable debug logging
showDebugInfobooleanfalseShow debug information in UI
baseUrlstring-Custom API base URL
redirectUristring-Custom redirect URI for OAuth

๐ŸŽจ Themingโ€‹

Built-in Themesโ€‹

The component supports custom theme objects instead of string-based themes:

// Default theme (empty object uses built-in defaults)
<PasskeymeAuthPanel theme={{}} />

// Dark theme
const darkTheme = {
container: {
backgroundColor: "#1f2937",
border: "1px solid #374151",
boxShadow: "0 10px 25px -5px rgba(0, 0, 0, 0.3)",
color: "#f9fafb",
},
title: {
color: "#f9fafb",
},
subtitle: {
color: "#d1d5db",
},
passkeyButton: {
backgroundColor: "#7c3aed",
backgroundColorHover: "#6d28d9",
color: "#ffffff",
},
dividerText: {
color: "#9ca3af",
},
};

<PasskeymeAuthPanel theme={darkTheme} />

Custom Themingโ€‹

import { PasskeymeAuthPanel } from '@passkeyme/react-auth';

const customTheme = {
container: {
backgroundColor: '#ffffff',
borderRadius: '12px',
boxShadow: '0 4px 20px rgba(0,0,0,0.1)',
padding: '24px',
maxWidth: '400px',
},
title: {
fontSize: '24px',
fontWeight: '600',
color: '#1a1a1a',
textAlign: 'center',
marginBottom: '8px',
},
subtitle: {
fontSize: '16px',
color: '#666666',
textAlign: 'center',
marginBottom: '24px',
},
passkeyButton: {
backgroundColor: '#007bff',
backgroundColorHover: '#0056b3',
color: '#ffffff',
borderRadius: '8px',
padding: '12px 16px',
fontSize: '16px',
fontWeight: '500',
},
};

<PasskeymeAuthPanel
appId="your-app-id"
theme={customTheme}
onSuccess={handleSuccess}
/>

CSS Classes for Advanced Stylingโ€‹

/* Target the main container */
.passkeyme-auth-panel {
border: 2px solid #e1e5e9;
}

/* Style the passkey button */
.passkeyme-passkey-button {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Style OAuth buttons */
.passkeyme-oauth-button {
border: 1px solid #ddd;
transition: all 0.2s ease;
}

.passkeyme-oauth-button:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Loading states */
.passkeyme-auth-panel[data-loading="true"] {
opacity: 0.7;
pointer-events: none;
}

๐Ÿ“ Layout Optionsโ€‹

Vertical Layout (Default)โ€‹

Stacks authentication options vertically - best for narrow containers.

<PasskeymeAuthPanel
appId="your-app-id"
layout="vertical"
onSuccess={handleSuccess}
/>

Horizontal Layoutโ€‹

Places authentication options side by side - best for wide containers.

<PasskeymeAuthPanel
appId="your-app-id"
layout="horizontal"
onSuccess={handleSuccess}
/>

Grid Layoutโ€‹

Arranges OAuth providers in a grid - best for many providers.

<PasskeymeAuthPanel
appId="your-app-id"
layout="grid"
providers={['google', 'github', 'microsoft', 'apple', 'discord']}
onSuccess={handleSuccess}
/>

๐Ÿ”ง Configuration Examplesโ€‹

Basic Login Onlyโ€‹

<PasskeymeAuthPanel
appId="your-app-id"
mode="login"
title="Welcome Back"
onSuccess={(user) => redirectToDashboard(user)}
/>

Registration Onlyโ€‹

<PasskeymeAuthPanel
appId="your-app-id"
mode="register"
title="Create Your Account"
subtitle="Join thousands of users who trust passkeys"
onSuccess={(user) => showOnboarding(user)}
/>

Custom Provider Selectionโ€‹

<PasskeymeAuthPanel
appId="your-app-id"
providers={['google', 'github']}
title="Developer Sign In"
onSuccess={(user, method) => {
console.log(`Authenticated via ${method}`);
setUser(user);
}}
/>

Passkey-Only Authenticationโ€‹

<PasskeymeAuthPanel
appId="your-app-id"
providers={[]} // No OAuth providers
title="Secure Access"
passkeyText="Unlock with Biometrics"
onSuccess={handleSecureAccess}
/>

Enterprise Configurationโ€‹

<PasskeymeAuthPanel
appId="your-app-id"
providers={['microsoft', 'google']}
mode="login"
title="Enterprise Login"
theme={{
container: {
backgroundColor: '#f8f9fa',
border: '1px solid #dee2e6',
},
passkeyButton: {
backgroundColor: '#0d6efd',
backgroundColorHover: '#0b5ed7',
},
}}
onSuccess={(user, method) => {
// Track enterprise authentication
analytics.track('enterprise_login', { method });
setUser(user);
}}
/>

๐Ÿ”„ Event Handlingโ€‹

Success Eventโ€‹

The onSuccess callback receives the authenticated user and the method used:

const handleAuthSuccess = (user, method) => {
console.log('Authentication successful:', { user, method });

// Method can be: 'passkey', 'google', 'github', 'microsoft', etc.
switch (method) {
case 'passkey':
analytics.track('passkey_login');
break;
case 'google':
analytics.track('oauth_login', { provider: 'google' });
break;
}

// Store user state
setUser(user);

// Redirect or update UI
navigate('/dashboard');
};

<PasskeymeAuthPanel
appId="your-app-id"
onSuccess={handleAuthSuccess}
/>

Error Handlingโ€‹

const handleAuthError = (error) => {
console.error('Authentication failed:', error);

// Handle different error types
if (error.code === 'PASSKEY_NOT_SUPPORTED') {
setErrorMessage('Passkeys are not supported on this device. Please use OAuth.');
} else if (error.code === 'USER_CANCELLED') {
// User cancelled authentication - usually no action needed
return;
} else {
setErrorMessage('Authentication failed. Please try again.');
}
};

<PasskeymeAuthPanel
appId="your-app-id"
onSuccess={handleSuccess}
onError={handleAuthError}
/>

Provider Selection Trackingโ€‹

<PasskeymeAuthPanel
appId="your-app-id"
onProviderSelect={(provider) => {
console.log('User selected provider:', provider);
analytics.track('auth_provider_selected', { provider });
}}
onPasskeyAttempt={() => {
console.log('User attempting passkey authentication');
analytics.track('passkey_attempt');
}}
onSuccess={handleSuccess}
/>

๐Ÿงช State Management Integrationโ€‹

Redux Integrationโ€‹

import { useDispatch } from 'react-redux';
import { setUser, setAuthLoading, setAuthError } from './authSlice';

function LoginForm() {
const dispatch = useDispatch();

const handleAuthSuccess = (user, method) => {
dispatch(setUser({ user, method }));
dispatch(setAuthLoading(false));
};

const handleAuthError = (error) => {
dispatch(setAuthError(error.message));
dispatch(setAuthLoading(false));
};

return (
<PasskeymeAuthPanel
appId="your-app-id"
onSuccess={handleAuthSuccess}
onError={handleAuthError}
onPasskeyAttempt={() => dispatch(setAuthLoading(true))}
onProviderSelect={() => dispatch(setAuthLoading(true))}
/>
);
}

Context API Integrationโ€‹

import { useContext } from 'react';
import { AuthContext } from './AuthContext';

function LoginForm() {
const { setUser, setLoading, setError } = useContext(AuthContext);

return (
<PasskeymeAuthPanel
appId="your-app-id"
onSuccess={(user, method) => {
setUser(user);
setLoading(false);
}}
onError={(error) => {
setError(error.message);
setLoading(false);
}}
/>
);
}

๐Ÿš€ Best Practicesโ€‹

1. User Experienceโ€‹

// โœ… Good: Clear messaging and feedback
<PasskeymeAuthPanel
appId="your-app-id"
title="Welcome back to Acme Corp"
subtitle="Sign in to access your dashboard"
onSuccess={handleSuccess}
onError={(error) => showUserFriendlyError(error)}
/>

// โŒ Avoid: Generic messaging
<PasskeymeAuthPanel appId="your-app-id" />

2. Loading Statesโ€‹

// โœ… Good: Show loading state
const [isAuthenticating, setIsAuthenticating] = useState(false);

<PasskeymeAuthPanel
appId="your-app-id"
onPasskeyAttempt={() => setIsAuthenticating(true)}
onProviderSelect={() => setIsAuthenticating(true)}
onSuccess={() => setIsAuthenticating(false)}
onError={() => setIsAuthenticating(false)}
style={{
opacity: isAuthenticating ? 0.7 : 1,
pointerEvents: isAuthenticating ? 'none' : 'auto',
}}
/>

3. Responsive Designโ€‹

// โœ… Good: Responsive layout
const isMobile = useMediaQuery('(max-width: 768px)');

<PasskeymeAuthPanel
appId="your-app-id"
layout={isMobile ? 'vertical' : 'horizontal'}
spacing={isMobile ? 'compact' : 'normal'}
theme={{
container: {
maxWidth: isMobile ? '100%' : '400px',
padding: isMobile ? '16px' : '24px',
},
}}
/>

4. Analytics Integrationโ€‹

// โœ… Good: Comprehensive analytics
<PasskeymeAuthPanel
appId="your-app-id"
onSuccess={(user, method) => {
analytics.track('authentication_success', {
method,
user_id: user.id,
timestamp: new Date().toISOString(),
});
}}
onError={(error) => {
analytics.track('authentication_error', {
error_code: error.code,
error_message: error.message,
});
}}
onProviderSelect={(provider) => {
analytics.track('auth_provider_selected', { provider });
}}
/>

๐Ÿ“š Next Stepsโ€‹


PasskeymeAuthPanel provides the most complete inline authentication experience with minimal code. Perfect for applications that want to keep users engaged without redirects.