update google login client id for android
This commit is contained in:
@ -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>
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user