From 04c7469e685c060ebe4cec7b0fd5e0217fc72065 Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Thu, 30 Oct 2025 17:06:19 +0100 Subject: [PATCH] Fix --- web/lib/firebase/users.ts | 5 +++-- web/pages/_app.tsx | 3 ++- web/pages/auth/callback.tsx | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/web/lib/firebase/users.ts b/web/lib/firebase/users.ts index 09bbfdab..65758276 100644 --- a/web/lib/firebase/users.ts +++ b/web/lib/firebase/users.ts @@ -5,6 +5,7 @@ import {getAuth, GoogleAuthProvider, signInWithPopup} from 'firebase/auth' import {safeLocalStorage} from '../util/local' import {app} from './init' +import {IS_LOCAL, WEB_URL} from "common/envs/constants"; dayjs.extend(utc) @@ -88,7 +89,7 @@ export async function webviewGoogleSignin() { const params = new URLSearchParams({ client_id: GOOGLE_CLIENT_ID, - redirect_uri: 'https://www.compassmeet.com/auth/callback', + redirect_uri: `${WEB_URL}/auth/callback`, response_type: 'code', scope: 'openid email profile', code_challenge: codeChallenge, @@ -139,7 +140,7 @@ export async function webviewGoogleSignin() { // export const isRunningInAPK = () => typeof window !== 'undefined' && (window as any).IS_APK === true export async function firebaseLogin() { - if (isAndroidWebView()) { + if (isAndroidWebView() || IS_LOCAL) { console.log('Running in APK') return await webviewGoogleSignin() } diff --git a/web/pages/_app.tsx b/web/pages/_app.tsx index 9f2b5d54..b0a1a625 100644 --- a/web/pages/_app.tsx +++ b/web/pages/_app.tsx @@ -13,6 +13,7 @@ import {initTracking} from 'web/lib/service/analytics' import WebPush from "web/lib/service/web-push"; import AndroidPush from "web/lib/service/android-push"; import {GOOGLE_CLIENT_ID} from "web/lib/firebase/users"; +import {WEB_URL} from "common/envs/constants"; // See https://nextjs.org/docs/basic-features/font-optimization#google-fonts // and if you add a font, you must add it to tailwind config as well for it to work. @@ -87,7 +88,7 @@ function MyApp({Component, pageProps}: AppProps) { client_id: GOOGLE_CLIENT_ID, code, code_verifier: codeVerifier!, - redirect_uri: 'com.compassmeet://auth', + redirect_uri: `${WEB_URL}/auth/callback`, grant_type: 'authorization_code', } console.log('Body:', body); diff --git a/web/pages/auth/callback.tsx b/web/pages/auth/callback.tsx index f2d323df..d259a2e9 100644 --- a/web/pages/auth/callback.tsx +++ b/web/pages/auth/callback.tsx @@ -5,6 +5,7 @@ export default function GoogleAuthCallback() { useEffect(() => { async function fetchToken() { const params = new URLSearchParams(window.location.search); + console.log('/auth/callback code', params); const code = params.get('code'); const state = params.get('state'); console.log('/auth/callback code', code);