feat(auth): авторизация Pleily — JWT + device_id + auth_identities

Backend:
- POST /auth/device — анонимный вход по device_id (UUID)
- GET /auth/me — текущий юзер
- DELETE /me — удаление аккаунта (Apple требует)

БД:
- users.source TEXT DEFAULT 'telegram'
- users.device_id UUID UNIQUE
- users.apple_id TEXT UNIQUE
- app_user_id_seq (START -1 INCREMENT -1)
- auth_identities (provider, provider_uid, user_id)

Auth:
- JWT через PyJWT, APP_JWT_SECRET из .env
- Authorization: Bearer <token> в require_auth
- Rate limit /auth/device (5/60)

Отрицательные telegram_id для Pleily-юзеров.
This commit is contained in:
2026-10-07 11:21:18 +00:00
parent 5ed0de765d
commit a3f7d9521f
7 changed files with 369 additions and 15 deletions
+1
View File
@@ -37,3 +37,4 @@ urllib3==2.7.0
uvicorn==0.51.0
yarl==1.24.5
pdfplumber==0.11.10
PyJWT==2.15.1