An error occurs during the verification of the Forge Invocation Token

Hello there,

I get the following error when verify to FIT:

unexpected “aud” claim value [ `{ JWTClaimValidationFailed: unexpected “aud” claim value at exports.default (/var/task/node_modules/jose/dist/node/cjs/lib/jwt_claims_set.js:57:15)

This is the aud claim in FIT:

const validateAuthHeader = async (forgeInvocationToken: string, appId: string) => {
    logger.debug("forgeInvocationToken", forgeInvocationToken);
    const jwksUrl = 'https://forge.cdn.prod.atlassian-dev.net/.well-known/jwks.json';
    const JWKS = jose.createRemoteJWKSet(new URL(jwksUrl));

    logger.info('Attempting to validate the context token');
    const {payload} = await jose.jwtVerify(forgeInvocationToken, JWKS, {audience: appId, issuer: 'forge/invocation-token'});
    logger.info('Succssfully validated the context token');
    return payload;
}

Thanks in advance!
Furkan

1 Like

Hi @AbdulbakiFurkanTanrv , can you please make sure that the appId that you pass into you validateAuthHeader function is in the format ari:cloud:ecosystem::app/{your-app-id}. Details about the claims that are included in the FIT are explained here.

3 Likes

Hi @BoZhang ,

Thank you for your answer. I changed the appId for the audience field in the options parameter for the jose.jwtVerify function and it worked!

Regards,
Furkan