Auth Setup Guide
AI Knowledge Hub uses device-local auth (localStorage). This guide covers Google OAuth setup and session behavior.
Google Sign-In Setup
To enable "Sign in with Google" on the login and register pages:
- Go to Google Cloud Console → Credentials
- Create or select a project, then Create Credentials → OAuth client ID
- Configure the OAuth consent screen if prompted
- Choose Web application, add your origins (e.g.
https://your-domain.com) - Copy the Client ID (format:
123456789-abc.apps.googleusercontent.com) - Log in to Admin → Settings → paste the Client ID → Save
The Client ID is stored in localStorage on this device. The "Sign in with Google" button will appear on login and register pages.
Session & Login Behavior
| Setting | Value | Notes |
|---|---|---|
| Session length | 7 days | Sessions expire 7 days after login |
| Expiry notice | Under 2 days | Header shows "Session expires in X hours/days" when logged in |
| Storage | Device only | Accounts and data stay in this browser |
All sessions last 7 days by design. Use Profiles to export a backup.
Local / Demo Mode & Production Plan
Current setup: Auth uses device-local storage (localStorage). No backend — suitable for personal use and demos. Data is not synced across devices. For production with multi-device sync and persistent accounts, consider migrating to Firebase or another backend.
Firebase migration: Replace auth.js with Firebase Auth + Firestore. Store stack, ratings, directUse, wantToTry per user in Firestore. Add feature-flag to switch between local and Firebase.
Full migration details are in docs/AUTH.md in the project source.