specify multiple aud values when verifying google tokens

This commit is contained in:
Satindar Dhillon 2022-08-24 21:00:15 -07:00
parent 784bf8e8e7
commit 2a273ef504

View file

@ -59,6 +59,7 @@ export const validateGoogleUser = async (
const iosClientId = env.google.auth.iosClientId
const webClientId = env.google.auth.clientId
const androidClientId = env.google.auth.androidClientId
const googleWebClient = new OAuth2Client(webClientId)
const googleIOSClient = new OAuth2Client(iosClientId)
@ -72,7 +73,7 @@ export async function decodeGoogleToken(
const loginTicket = await googleMobileClient.verifyIdToken({
idToken,
audience: isAndroid ? env.google.auth.androidClientId : iosClientId,
audience: [iosClientId, webClientId, androidClientId],
})
const email = loginTicket.getPayload()?.email