function verifyInstanceToken
verifyInstanceToken(
token: string,
jwks: JSONWebKeySet,
claims: { issuer: string; audience: string; }
): Promise<JWTPayload>

Returns the payload of token once its signature checks against jwks, the keys of issuer, and it is addressed to audience and unexpired.

Parameters

token: string
jwks: JSONWebKeySet
claims: { issuer: string; audience: string; }

Return Type

Promise<JWTPayload>

Throws

Error

jose's error when it doesn't verify; its code is ERR_JWKS_NO_MATCHING_KEY when no key of jwks has its kid, which tells the caller to refetch the keys, the issuer having rotated them.

Usage

import { verifyInstanceToken } from "api/lib/jwt.ts";