feat(android): APK loads live web, fix cold-start deep links for Google OAuth
APK architecture change: replaces bundled React SPA with minimal redirect page that always loads live web content. No more APK rebuilds for web changes. Root cause of OAuth failure on Android: 1. Cold-start deep links lost — APK's old bundled JS called onOpenUrl() (warm-start listener only) but NOT getCurrent() which is required for cold-start deep links. Fix: redirect page + setupDeepLinkHandler both call getCurrent() before redirecting/navigating. 2. Session cookie was dropped — renderTauriDeepLinkPage returned a raw new Response() which overwrote the Set-Cookie header set by the callback handler. Fix: inject Set-Cookie into the Response. 3. tauri.conf.json frontendDist → "./web/dist-tauri" (redirect page) 4. Added @tauri-apps/plugin-deep-link and @tauri-apps/plugin-opener as web app deps so live-web imports work in Tauri WebView. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -314,12 +314,18 @@ export const authRoutes = new Elysia({ prefix: '/api/v1/auth' })
|
||||
}
|
||||
|
||||
const token = await createSession(user.id);
|
||||
set.headers['Set-Cookie'] = createSessionCookie(token, request.headers);
|
||||
const sessionCookie = createSessionCookie(token, request.headers);
|
||||
|
||||
authCounter.labels('login', 'true').inc();
|
||||
|
||||
const successUrl = `${env.webAppUrl}/login?token=${encodeURIComponent(token)}`;
|
||||
if (platform === 'tauri') return renderTauriDeepLinkPage(successUrl);
|
||||
if (platform === 'tauri') {
|
||||
// Inject Set-Cookie into the response so the browser gets it on redirect
|
||||
const resp = renderTauriDeepLinkPage(successUrl);
|
||||
resp.headers.set('Set-Cookie', sessionCookie);
|
||||
return resp;
|
||||
}
|
||||
set.headers['Set-Cookie'] = sessionCookie;
|
||||
set.status = 302;
|
||||
set.headers['Location'] = successUrl;
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user