SPB Git forge

spb/api-ka

Public

API-KA — plateforme centrale : collecte quotidienne des 8 services KA, historisation append-only et API publique sur www.api-ka.com

48commits 1branches 0releases
5.9 MBsize
maindefault branch
20 days agolast push
Python 60.9% HTML 21% TypeScript 7.3% JavaScript 5.2% CSS 4.8% Shell 0.8%

Auth mobile : accepter aud ka-android (même secret partagé que ka-ios)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Simon-Pierre Boucher committed 1 mo ago (Aug 18, 2026) parent d1a35a1

1 changed file +2 −1

modified src/api/routes/iosauth.py +2 −1
@@ -21,6 +21,7 @@ router = APIRouter(prefix="/api/ios/auth", tags=["ios-auth"])
21 21
22 22 HUB = os.environ.get("KA_HUB_URL", "https://www.groupe-ka.com").rstrip("/")
23 23 CLIENT_ID = "ka-ios"
24 +CLIENT_IDS = {"ka-ios", "ka-android"}
24 25
25 26
26 27 def _secret() -> bytes:
@@ -44,7 +45,7 @@ def _verify_jwt(token: str) -> dict[str, Any]:
44 45 expected = hmac.new(_secret(), f"{h64}.{p64}".encode(), hashlib.sha256).digest()
45 46 if not hmac.compare_digest(expected, _b64d(s64)):
46 47 raise ValueError("signature")
47 − if payload.get("aud") != CLIENT_ID:
48 + if payload.get("aud") not in CLIENT_IDS:
48 49 raise ValueError("aud")
49 50 if payload.get("iss") != HUB:
50 51 raise ValueError("iss")
51 52