Skip to content

Commit 213c56f

Browse files
committed
Fix
1 parent ccde6e4 commit 213c56f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

web/lib/firebase/users.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export const GOOGLE_CLIENT_ID = WEB_GOOGLE_CLIENT_ID
7676
* Authenticates a Firebase client running a webview APK on Android with Google OAuth.
7777
*
7878
* `https://accounts.google.com/o/oauth2/v2/auth?${params}` to get the code (in external browser, as google blocks it in webview)
79-
* Redirects to `com.compassmeet:/auth` (in webview java main activity)
79+
* Redirects to `com.compassmeet://auth` (in webview java main activity)
8080
* 'https://oauth2.googleapis.com/token' to get the ID token (in javascript app)
8181
* signInWithCredential(auth, credential) to set up firebase user in client (auth.currentUser)
8282
*

web/pages/_app.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,11 @@ function MyApp({Component, pageProps}: AppProps<PageProps>) {
6969
console.log('Registering OAuth redirect listener for Android WebView')
7070

7171
window.addEventListener('oauthRedirect', async (event: any) => {
72+
console.log('Received oauthRedirect event');
7273
console.log('Received oauthRedirect event:', event.detail);
73-
const url = new URL(event.detail);
74+
const detail = typeof event.detail === 'string' ? JSON.parse(event.detail) : event.detail
75+
console.log('OAuth data:', detail);
76+
const url = new URL(detail);
7477

7578
const code = url.searchParams.get('code');
7679
if (!code) {
@@ -87,7 +90,7 @@ function MyApp({Component, pageProps}: AppProps<PageProps>) {
8790
client_id: GOOGLE_CLIENT_ID,
8891
code,
8992
code_verifier: codeVerifier!,
90-
redirect_uri: 'com.compassmeet:/auth',
93+
redirect_uri: 'com.compassmeet://auth',
9194
grant_type: 'authorization_code',
9295
}),
9396
});

0 commit comments

Comments
 (0)