How to resolve this Error: The token's payload does not contain "appid" property,

Stanley Arua 0 Reputation points
2023-10-01T11:32:38.2866667+00:00

i am validating the AAD token i got with

...
const validate = require("validate-azure-ad-token").default;

//validate the token with it
    const decodedTokenAzure = await validate(token, {
      tenantId: process.env.<TENANT_ID>,
      clientSecret:process.env.<CLIENT_SECRET>,
      audience: process.env.<AUDIENCE>,
      applicationId: process.env.<CLIENT_ID>,
      scopes: ["user.read"],
    });

but i got this Error: The token's payload does not contain "appid" property,
The Token version 2, is there any configuration that needs to be set in azure portal for the appId to be included in the payload returned, how do i resolve this?

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
22,136 questions
{count} votes

1 answer

Sort by: Most helpful
  1. 2023-10-02T21:19:20.4166667+00:00

    Hello @Stanley Arua , the appId claim is only available in V1.0 tokens which seems to be the version expected by the validate-azure-ad-token library. For V2.0 tokens you might try another library such as jsonwebtoken.

    Let us know if you need additional assistance. If the answer was helpful, please accept it and rate it so that others facing a similar issue can easily find a solution.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.