Revert auto-login via /login?token=... — WKWebView casse le redirect 303

WebKit error code 102 (Frame load interrupted by policy change) sur le redirect
303 retourné par /login après pose du cookie. Solution Phase 0 : laisser le
user saisir le token une fois via le formulaire /login standard, le cookie
coach_web_token (1 an, secure, httponly, samesite=lax) doit persister dans
WKWebView pour les lancements suivants.

Si la persistance cookie échoue : inject natif via AppDelegate.swift à venir.
This commit is contained in:
Sylvain Bettinelli
2026-05-05 19:24:14 +00:00
parent 3e71dbe3a3
commit b64a4029e7

View File

@@ -1,19 +1,4 @@
import type { CapacitorConfig } from '@capacitor/cli'; import type { CapacitorConfig } from '@capacitor/cli';
import { readFileSync, existsSync } from 'fs';
import { resolve } from 'path';
// Token d'auth coach.hypnotruck.ch chargé depuis coach-ios.local.json (gitignored).
// Sur le Mac mini : créer ce fichier avec { "coachWebToken": "..." } avant de builder.
const localConfigPath = resolve(__dirname, 'coach-ios.local.json');
const localConfig = existsSync(localConfigPath)
? JSON.parse(readFileSync(localConfigPath, 'utf-8'))
: {};
const coachWebToken: string = localConfig.coachWebToken || '';
const baseUrl = 'https://coach.hypnotruck.ch';
const startUrl = coachWebToken
? `${baseUrl}/login?token=${encodeURIComponent(coachWebToken)}`
: baseUrl;
const config: CapacitorConfig = { const config: CapacitorConfig = {
appId: 'ch.hypnotruck.coach', appId: 'ch.hypnotruck.coach',
@@ -21,7 +6,7 @@ const config: CapacitorConfig = {
webDir: 'www', webDir: 'www',
server: { server: {
url: startUrl, url: 'https://coach.hypnotruck.ch',
cleartext: false, cleartext: false,
androidScheme: 'https', androidScheme: 'https',
}, },