# iPad OAuth Authentication Issue

## Problem Summary

Discord OAuth authentication fails on iPad browsers (Safari and Firefox) when accessing via `https://gameplay-demo.manticorum.com`.

## Root Cause

All JavaScript async operations (Promises, setTimeout, onMounted) are blocked on the iPad browser when loading the OAuth callback page (`/auth/callback`). Synchronous JavaScript executes normally, but any async callback never fires.

## Evidence

- Login redirect works (anchor tag with href)
- Callback page loads and renders
- Script setup code executes
- BUT: onMounted never fires, Promise.then() never executes, setTimeout never triggers

## Symptoms

- User clicks "Continue with Discord" → Redirects to Discord ✅
- User authenticates → Redirects back to callback page ✅
- Callback page shows "Authenticating..." spinner
- Page hangs indefinitely (async operations blocked) ❌

## Tested Solutions (All Failed on iPad)

1. ❌ Button with click handler → No effect
2. ✅ Anchor tag with href → Works for login redirect
3. ❌ onMounted hook → Never executes
4. ❌ setTimeout → Never fires
5. ❌ Promise callbacks (.then/.catch) → Never execute
6. ❌ Direct $fetch call → Hangs
7. ❌ Promise.race with timeout → Timeout never fires
8. ❌ Form submission → document.createElement fails (SSR issue)

## Likely Causes

1. **Content Security Policy (CSP)** blocking async operations
2. **Nginx Proxy Manager** injecting restrictive headers
3. **iOS Safari** security restrictions
4. **Browser settings** on the iPad

## Investigation Steps

1. Check browser console for CSP violations
2. Inspect response headers from `https://gameplay-demo.manticorum.com/auth/callback`
3. Test same flow on desktop browser
4. Test on different iPad/iOS version
5. Check Nginx proxy configuration

## Workarounds

### Option 1: Desktop Authentication
Authenticate on desktop first, then use iPad for gameplay

### Option 2: Backend-Driven Flow
Modify backend to handle OAuth callback server-side and set cookies, eliminating need for frontend JavaScript

### Option 3: Fix Environment
Debug and fix whatever is blocking async operations on iPad

## Session Date

2025-11-27

## Status

UNRESOLVED - Environmental issue, not code bug
