Add LinkedIn OAuth flow

- linkedin_auth API: generates auth URL with CSRF state stored in session
- linkedin_callback: exchanges code for tokens, writes to project's config.json
- index.php: route /linkedin/callback before auth check
- Connect button wired up in JS; reads LINKEDIN_CLIENT_ID/SECRET from server env

Server setup required:
  SetEnv LINKEDIN_CLIENT_ID ...
  SetEnv LINKEDIN_CLIENT_SECRET ...
Redirect URI to register in LinkedIn app: https://<host>/linkedin/callback

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Bashy 2026-05-26 17:25:38 +03:00
parent 3d7b620b6c
commit 158a5b0775
5 changed files with 126 additions and 3 deletions

View file

@ -15,6 +15,13 @@ if ($uri === '/api/auth') {
exit;
}
// LinkedIn OAuth callback — session required but no full auth check
// (LinkedIn redirects back here; user's browser session is active)
if ($uri === '/linkedin/callback') {
include ROOT . '/web/linkedin_callback.php';
exit;
}
// All other routes require login
Auth::requireLogin();
ProjectTypes::load();