mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-04-03 22:44:35 -04:00
Fix
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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<PageProps>) {
|
||||
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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user