Skip to content

Commit 04c7469

Browse files
committed
Fix
1 parent 98bc0a9 commit 04c7469

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

web/lib/firebase/users.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {getAuth, GoogleAuthProvider, signInWithPopup} from 'firebase/auth'
55

66
import {safeLocalStorage} from '../util/local'
77
import {app} from './init'
8+
import {IS_LOCAL, WEB_URL} from "common/envs/constants";
89

910
dayjs.extend(utc)
1011

@@ -88,7 +89,7 @@ export async function webviewGoogleSignin() {
8889

8990
const params = new URLSearchParams({
9091
client_id: GOOGLE_CLIENT_ID,
91-
redirect_uri: 'https://www.compassmeet.com/auth/callback',
92+
redirect_uri: `${WEB_URL}/auth/callback`,
9293
response_type: 'code',
9394
scope: 'openid email profile',
9495
code_challenge: codeChallenge,
@@ -139,7 +140,7 @@ export async function webviewGoogleSignin() {
139140
// export const isRunningInAPK = () => typeof window !== 'undefined' && (window as any).IS_APK === true
140141

141142
export async function firebaseLogin() {
142-
if (isAndroidWebView()) {
143+
if (isAndroidWebView() || IS_LOCAL) {
143144
console.log('Running in APK')
144145
return await webviewGoogleSignin()
145146
}

web/pages/_app.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {initTracking} from 'web/lib/service/analytics'
1313
import WebPush from "web/lib/service/web-push";
1414
import AndroidPush from "web/lib/service/android-push";
1515
import {GOOGLE_CLIENT_ID} from "web/lib/firebase/users";
16+
import {WEB_URL} from "common/envs/constants";
1617

1718
// See https://nextjs.org/docs/basic-features/font-optimization#google-fonts
1819
// 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<PageProps>) {
8788
client_id: GOOGLE_CLIENT_ID,
8889
code,
8990
code_verifier: codeVerifier!,
90-
redirect_uri: 'com.compassmeet://auth',
91+
redirect_uri: `${WEB_URL}/auth/callback`,
9192
grant_type: 'authorization_code',
9293
}
9394
console.log('Body:', body);

web/pages/auth/callback.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export default function GoogleAuthCallback() {
55
useEffect(() => {
66
async function fetchToken() {
77
const params = new URLSearchParams(window.location.search);
8+
console.log('/auth/callback code', params);
89
const code = params.get('code');
910
const state = params.get('state');
1011
console.log('/auth/callback code', code);

0 commit comments

Comments
 (0)