OAuth — Hugging Face Login
The Collab Hub uses Hugging Face OAuth for authentication. Users log in with their HF account to vote on annotations and save papers.
Setup
1. Create an OAuth App
Go to Hugging Face OAuth Apps and create a new app:
- Name:
Echo-DSRN Collab Hub - Homepage URL:
http://localhost:7860(or your production URL) - Redirect URL:
http://localhost:7860/api/auth/callback/hf
2. Configure .env
APP_BASE_URL=http://localhost:7860
HF_CLIENT_ID=<your-client-id>
HF_CLIENT_SECRET=<your-client-secret>
3. Production
Replace localhost:7860 with your production domain. Both the Homepage URL and Redirect URL must match.
Redirect URL: https://echo-dsrn.example.com/api/auth/callback/hf
How it works
- User clicks "Login with Hugging Face" in the Collab Hub
- Redirected to HF authorization page
- After consent, redirected back to
/api/auth/callback/hf - Backend exchanges code for token, fetches user profile
- JWT session cookie set — user is authenticated
User data stored: HF username, name, email, avatar URL, and optionally institution (from profile).