Anyone could help guide me with validating the ID JWT token Google provides when using Google auth?
Google suggests using a library but there is none for Deno it seems.
I saw some JWT packages but when I try to verify the JWT I get this error The alg 'RS256' demands a key. so I'm likely missing some stuff here.
I'm not super familiar with JWT and struggling quite a bit to get something working.
https://developers.google.com/identity/sign-in/web/backend-auth#using-a-google-api-client-library
This is some of the code I tried
import { decode as jwtDecode, Payload, verify as jwtVerify } from "https://deno.land/x/[email protected]/mod.ts";
public async validateToken(id_token: string): Promise<Payload> {
const token = this.decodeIdToken(id_token);
const response = await fetch("https://www.googleapis.com/oauth2/v3/certs");
const cert = await response.json();
const verifiedToken = await jwtVerify(id_token, cert[token.header.kid]);
}