update google login client id for android

This commit is contained in:
Satindar Dhillon
2022-08-19 19:39:41 -07:00
parent 33a4ee39dc
commit 1115cf34d9
2 changed files with 5 additions and 6 deletions

View File

@ -1,4 +1,4 @@
<resources>
<string name="app_name">Omnivore</string>
<string name="gcp_id">590528454690-ovh9ku5r3fojgr1pp5kgaimr43o96btb.apps.googleusercontent.com</string>
<string name="gcp_id">590528454690-mpmbvcb4c3ifmnojmrultt37eo8f64at.apps.googleusercontent.com</string>
</resources>

View File

@ -58,22 +58,21 @@ export const validateGoogleUser = async (
}
const iosClientId = env.google.auth.iosClientId
const androidClientId = env.google.auth.androidClientId
const webClientId = env.google.auth.clientId
const googleWebClient = new OAuth2Client(env.google.auth.clientId)
const googleWebClient = new OAuth2Client(webClientId)
const googleIOSClient = new OAuth2Client(iosClientId)
const googleAndroidClient = new OAuth2Client(androidClientId)
export async function decodeGoogleToken(
idToken: string,
isAndroid: boolean
): Promise<DecodeTokenResult> {
try {
const googleMobileClient = isAndroid ? googleAndroidClient : googleIOSClient
const googleMobileClient = isAndroid ? googleWebClient : googleIOSClient
const loginTicket = await googleMobileClient.verifyIdToken({
idToken,
audience: isAndroid ? androidClientId : iosClientId,
audience: isAndroid ? webClientId : iosClientId,
})
const email = loginTicket.getPayload()?.email