What problem does it solve?
This skill provides clear patterns and recipes to implement authentication in React single-page applications using the Clerk React SDK, eliminating common mistakes like unguarded auth checks, incorrect provider placement, and insecure token handling.
Core Features & Use Cases
- Protected route patterns and route-level guards using isLoaded and isSignedIn to prevent unauthorized access.
- Hook usage guidance for obtaining session tokens, reading user profiles, and performing programmatic actions such as sign out and opening user or organization profiles.
- Templates and examples tailored for Vite and Create React App, React Router integration, and custom sign-in and sign-up flows.
- Use Case: Secure a dashboard and settings area behind authentication, retrieve a session JWT for backend API calls, and implement a custom email/password sign-in that activates the session.
Quick Start
Add ClerkProvider to your Vite React app, protect /dashboard and /settings with a ProtectedRoute that checks isLoaded and isSignedIn, and implement a custom sign-in form using useSignIn that creates and activates a session on success.