Complete Example
Configure Logto Provider
Wrap your app with the
AuthProvider to enable authentication throughout your application:App.tsx
Create Protected Dashboard
Build a protected dashboard page that requires authentication:
pages/Dashboard.tsx
Features Demonstrated
This example showcases:- Authentication Provider: Global auth state management
- Popup Sign-In: Optional popup-based authentication flow
- User Center Component: Pre-built user menu with avatar and sign-out
- Protected Routes: Automatic redirection for unauthenticated users
- Loading States: Proper handling of authentication loading states
- User Profile Display: Accessing and displaying user information
Running the Example
http://localhost:3000 to see the app in action.
Next Steps
Protected Routes
Learn advanced patterns for protecting routes
Next.js Example
See how to use logto-authkit with Next.js