- VK ID OAuth 2.1 (Authorization Code + PKCE) with server-side token exchange.
- Stores users in Postgres (Neon).
- Issues HttpOnly session cookie
sid
on the backend domain.
See .env.example
. Critical:
VK_REDIRECT_URI
must be EXACTLY the one in VK app settings.FRONTEND_URL
is your Netlify URL (CORS + post-login redirect).DATABASE_URL
must includesslmode=require
for Neon.
- Runtime: Node 18+
- Build Command:
npm ci
- Start Command:
npm start
(Миграций нет — таблицы создаются автоматически при старте.)
GET /api/auth/vk/start
→ setsstate
+code_verifier
cookies, redirects toid.vk.com/authorize
.GET /api/auth/vk/callback
→ exchangescode
(+device_id
) for tokens, creates/updates user, setssid
cookie, redirects toFRONTEND_URL?logged=1
.GET /api/me
→ returns user based onsid
cookie.GET /health
→ healthcheck.