Overview
Polaris uses Clerk for authentication with the following features:- GitHub OAuth integration
- User session management
- Protected routes
- Convex integration for user identity
Setup steps
Create a Clerk application
- Go to clerk.com and create an account
- Create a new application
- Choose GitHub as your authentication provider
- Copy your publishable key and secret key
Convex integration
Clerk integrates with Convex to provide user identity in backend queries and mutations.Configuration
The Convex auth configuration is inconvex/auth.config.ts:
Getting user identity
In Convex functions, access the authenticated user:Protected routes
Polaris uses Clerk middleware to protect routes. Only authenticated users can access the/projects routes.
Authentication flow
- User visits Polaris
- If not authenticated, Clerk shows the sign-in UI
- User clicks “Sign in with GitHub”
- GitHub OAuth flow completes
- Clerk creates a session
- User is redirected to the projects dashboard
- Session token is passed to Convex for backend authentication
Customization
Polaris uses the dark theme from@clerk/themes:
variables to the appearance object.
Testing
- Start your development server
- Visit
http://localhost:3000 - You should see the Clerk sign-in UI
- Sign in with your GitHub account
- Verify you’re redirected to
/projects
Troubleshooting
Invalid publishable key error
Invalid publishable key error
Verify your
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY is correct and starts with pk_test_ or pk_live_.GitHub OAuth not working
GitHub OAuth not working
Make sure GitHub is enabled in your Clerk dashboard under Configure → SSO Connections → GitHub.
Convex authentication failing
Convex authentication failing
Ensure your Convex deployment has the Clerk integration configured. Run
npx convex dev and check the auth setup.