mirror of
https://github.com/jason5ng32/MyIP.git
synced 2026-11-04 08:55:47 +00:00
The installed iOS PWA opens an out-of-scope authDomain in the system's in-app browser view, whose storage the PWA's own webview cannot read, so a redirect sign-in completed there never reached the app. The frontend server and the Vite dev server now proxy /__/auth/* to https://<project>.firebaseapp.com (common/firebase-auth-proxy.js), mounted only when VITE_FIREBASE_PROJECT_ID is set, so with VITE_FIREBASE_AUTH_DOMAIN set to the site's host the handler runs in-scope, inside the PWA itself. .env.example documents the three keys and the console-side requirements (authorized domain, OAuth callback at https://<host>/__/auth/handler). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013GbLTGMZ45MV78qd2tHoco
29 lines
1.1 KiB
JavaScript
29 lines
1.1 KiB
JavaScript
// Spec for common/firebase-auth-proxy.js — the `/__/auth` proxy target.
|
|
import assert from 'node:assert/strict';
|
|
import { describe, it } from 'node:test';
|
|
|
|
import { FIREBASE_AUTH_PROXY_PATH, firebaseAuthProxyTarget } from '../common/firebase-auth-proxy.js';
|
|
|
|
describe('firebaseAuthProxyTarget()', () => {
|
|
it('returns null without a project id', () => {
|
|
assert.equal(firebaseAuthProxyTarget(undefined), null);
|
|
assert.equal(firebaseAuthProxyTarget(null), null);
|
|
assert.equal(firebaseAuthProxyTarget(''), null);
|
|
assert.equal(firebaseAuthProxyTarget(' '), null);
|
|
});
|
|
|
|
it('maps a project id onto its firebaseapp.com origin', () => {
|
|
assert.equal(firebaseAuthProxyTarget('my-project'), 'https://my-project.firebaseapp.com');
|
|
});
|
|
|
|
it('trims surrounding whitespace', () => {
|
|
assert.equal(firebaseAuthProxyTarget(' my-project \n'), 'https://my-project.firebaseapp.com');
|
|
});
|
|
});
|
|
|
|
describe('FIREBASE_AUTH_PROXY_PATH', () => {
|
|
it('is the Firebase Auth handler prefix', () => {
|
|
assert.equal(FIREBASE_AUTH_PROXY_PATH, '/__/auth');
|
|
});
|
|
});
|