Overview
GitStarRecall supports two authentication methods:- OAuth (Recommended) - Secure authorization flow with PKCE
- Personal Access Token (PAT) - Fallback for power users
OAuth is recommended for better security. Tokens are held in memory and never persisted to localStorage in raw form.
OAuth Setup (Recommended)
OAuth uses the PKCE (Proof Key for Code Exchange) flow to keep your GitHub credentials secure. The client secret is only used server-side during token exchange.Step 1: Create GitHub OAuth App
Navigate to GitHub Developer Settings
Go to GitHub Developer Settings and click OAuth Apps → New OAuth App.
Step 2: Configure Environment Variables
Set up both client-side and server-side environment variables:Both
VITE_GITHUB_REDIRECT_URI and GITHUB_OAUTH_REDIRECT_URI must be identical and match your GitHub OAuth app callback URL.Step 3: OAuth Flow Details
The OAuth flow works as follows:Redirect to GitHub Authorization
User is redirected to GitHub with PKCE parameters:
Requested scopes:
read:user- Read user profile informationrepo- Access repositories including private starred repos
Exchange Code for Token
The app sends the code to the backend exchange endpoint:Backend exchanges with GitHub using client secret:
Vercel Deployment
For production deployment on Vercel:Verify Routing Configuration
The included This ensures
vercel.json handles SPA routing:/auth/callback refreshes work correctly.Personal Access Token (PAT) Fallback
For development or self-hosted deployments, you can use a Personal Access Token instead of OAuth.Step 1: Create GitHub PAT
Navigate to Token Settings
Go to GitHub Personal Access Tokens and click Generate new token → Generate new token (classic).
Configure Token Scopes
Select the required scopes:
read:user- Read user profilerepo- Full access to repositories (required for private starred repos)
Step 2: Use PAT in GitStarRecall
Security Considerations
Token Storage
- OAuth tokens: Stored in React state (memory only)
- PAT tokens: Stored in React state (memory only)
- No persistence: Tokens are never written to localStorage, sessionStorage, or IndexedDB
- Page refresh: Requires re-authentication
OAuth Security Features
PKCE Flow
Proof Key for Code Exchange prevents authorization code interception attacks
State Validation
Random state parameter prevents CSRF attacks
Client Secret Isolation
Client secret never exposed to browser - only used server-side
Scope Minimization
Requests only
read:user and repo scopes - no write accessContent Security Policy
The app enforces a strict CSP with explicit allowlist:Logout and Token Cleanup
To clear authentication:Token Cleared
The app clears:
- Access token from memory
- Authentication method state
- LLM provider settings
Troubleshooting
OAuth exchange failed (400)
OAuth exchange failed (400)
Possible causes:
- Client ID mismatch between
VITE_GITHUB_CLIENT_IDandGITHUB_OAUTH_CLIENT_ID - Redirect URI mismatch between env vars and GitHub OAuth app settings
- Client secret incorrect or expired
- Verify all environment variables match exactly
- Check GitHub OAuth app settings
- Regenerate client secret if needed
OAuth callback 404
OAuth callback 404
Possible causes:
- Callback URL in GitHub OAuth app doesn’t match
VITE_GITHUB_REDIRECT_URI - Production SPA routing not configured correctly
- Ensure callback URL ends with
/auth/callback - Verify
vercel.jsonor equivalent SPA fallback is configured - Check that both
VITE_GITHUB_REDIRECT_URIandGITHUB_OAUTH_REDIRECT_URIare identical
PAT returns 401 Unauthorized
PAT returns 401 Unauthorized
OAuth state mismatch error
OAuth state mismatch error
Possible causes:
- SessionStorage cleared between authorization and callback
- Multiple OAuth flows started simultaneously
- Browser privacy mode interfering with sessionStorage
- Don’t clear browser data during OAuth flow
- Complete one OAuth flow before starting another
- Try in normal (non-incognito) browser mode
Can't access private starred repos
Can't access private starred repos
Possible causes:
- Missing
reposcope in OAuth or PAT - Token doesn’t have access to organization repositories
- Ensure
reposcope is granted (not justpublic_repo) - For organization repos, verify token has organization access
- Check GitHub token settings for scope details