@@ -12,7 +12,7 @@ import clsx from 'clsx'
1212import { initTracking } from 'web/lib/service/analytics'
1313import WebPush from "web/lib/service/web-push" ;
1414import AndroidPush from "web/lib/service/android-push" ;
15- import { ANDROID_GOOGLE_CLIENT_ID } from "web/lib/firebase/users " ;
15+ import { unauthedApi } from "common/util/api " ;
1616
1717// See https://nextjs.org/docs/basic-features/font-optimization#google-fonts
1818// and if you add a font, you must add it to tailwind config as well for it to work.
@@ -81,24 +81,9 @@ function MyApp({Component, pageProps}: AppProps<PageProps>) {
8181 return ;
8282 }
8383
84- const codeVerifier = localStorage . getItem ( 'pkce_verifier' ) ;
85-
86- const body = {
87- client_id : ANDROID_GOOGLE_CLIENT_ID ,
88- code,
89- code_verifier : codeVerifier ! ,
90- redirect_uri : 'com.compassmeet:/auth' ,
91- grant_type : 'authorization_code' ,
92- }
93- console . log ( 'Body:' , body ) ;
94- const tokenResponse = await fetch ( 'https://oauth2.googleapis.com/token' , {
95- method : 'POST' ,
96- headers : { 'Content-Type' : 'application/x-www-form-urlencoded' } ,
97- body : new URLSearchParams ( body ) ,
98- } ) ;
99-
100- const tokens = await tokenResponse . json ( ) ;
101- console . log ( 'Tokens:' , tokens ) ;
84+ const { result} = await unauthedApi ( 'auth-google' , { code} )
85+ console . log ( '/auth-google result' , result ) ;
86+ // google sign in
10287 }
10388
10489 // Expose globally for native bridge
0 commit comments