docs: add quixzoom-auth-core product to AAMOS

- Product documentation in docs/products/
- Updated MEMORY.md with product info
- quiXzoom Auth Core as AAMOS Identity product
This commit is contained in:
Bernt
2026-07-14 09:58:53 +00:00
parent 58ca4e68db
commit 48ea61cdcc
2730 changed files with 293827 additions and 7213 deletions
+38
View File
@@ -5,6 +5,7 @@
import * as SecureStore from 'expo-secure-store'
const API_BASE = process.env.EXPO_PUBLIC_API_URL ?? 'https://api.quixzoom.com'
const AUTH_BASE = process.env.EXPO_PUBLIC_AUTH_URL ?? 'https://auth.quixzoom.com'
const TOKEN_KEY = 'qxz_jwt'
const REFRESH_KEY = 'qxz_refresh'
@@ -17,11 +18,48 @@ export async function getToken(): Promise<string | null> {
export async function setToken(token: string, refreshToken?: string): Promise<void> {
await SecureStore.setItemAsync(TOKEN_KEY, token)
if (refreshToken) await SecureStore.setItemAsync(REFRESH_KEY, refreshToken)
// Sync with SSO web cookies for cross-domain auth
await syncWebCookies(token, refreshToken)
}
/**
* Sync tokens with web SSO cookies
* This enables seamless auth between app and web
*/
async function syncWebCookies(accessToken: string, refreshToken?: string): Promise<void> {
try {
// Call SSO sync endpoint to set cookies on .quixzoom.com
await fetch(`${AUTH_BASE}/auth/sync`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${accessToken}`,
},
body: JSON.stringify({
refresh_token: refreshToken,
device_type: 'mobile_app',
}),
})
} catch {
// Best-effort: don't fail if sync fails
console.warn('Cookie sync failed - web auth may require separate login')
}
}
export async function clearTokens(): Promise<void> {
await SecureStore.deleteItemAsync(TOKEN_KEY)
await SecureStore.deleteItemAsync(REFRESH_KEY)
// Clear web cookies too
try {
await fetch(`${AUTH_BASE}/auth/logout`, {
method: 'POST',
credentials: 'include',
})
} catch {
// Best-effort
}
}
// ─── Base fetch with JWT ───────────────────────────────────────────────────