Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions apps/web/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,22 @@ const nextConfig: NextConfig = {
// for type info + tsconfig paths instead. Requires Next >= 16.3.
useTypeScriptCli: true,
},
// Same-origin proxy for Firebase's auth handler so signInWithRedirect isn't
// blocked by Safari ITP. Must be a rewrite (transparent), not a 302.
// https://firebase.google.com/docs/auth/web/redirect-best-practices
async rewrites() {
const authHelper = 'https://bypass-links.firebaseapp.com';
return [
{
source: '/__/auth/:path*',
destination: `${authHelper}/__/auth/:path*`,
},
{
source: '/__/firebase/:path*',
destination: `${authHelper}/__/firebase/:path*`,
},
];
},
Comment thread
greptile-apps[bot] marked this conversation as resolved.
};

export default nextConfig;
3 changes: 3 additions & 0 deletions apps/web/src/app/helpers/firebase/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { getFirebasePublicConfig } from '@bypass/configs/firebase.config';
import { initializeApp } from 'firebase/app';

// The Safari redirect fix (same-origin authDomain + /__/auth proxy) is applied
// to prod only. Local dev keeps the cross-domain authDomain — replicating it
// needs https dev + a separate OAuth redirect URI, which isn't worth the setup.
const firebaseApp = initializeApp(
getFirebasePublicConfig(process.env.NODE_ENV === 'production')
);
Expand Down
3 changes: 2 additions & 1 deletion packages/configs/firebase.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ export const getFirebasePublicConfig = (isProd: boolean) => {
if (isProd) {
return {
apiKey: 'AIzaSyDiMRlBhW36sLjEADoQj9T5L1H-hIDUAso',
authDomain: 'bypass-links.firebaseapp.com',
// Same-origin as the app (vs Safari ITP); /__/auth/* proxied in next.config.
authDomain: 'bypass-links.vercel.app',
databaseURL: 'https://bypass-links.firebaseio.com/',
projectId: 'bypass-links',
storageBucket: 'bypass-links.appspot.com',
Expand Down
Loading