I am working on a Node project and I am having issues getting the roles from the claims. I see the roles assigned to the user in the Authorization extension. I have the following code to check it…
app.get(
"/secure",
oidc.claimCheck((claims) => {
console.log(`The roles are ${JSON.stringify(claims.roles)}`)
return claims.isAdmin || ( claims.roles && claims.roles.includes('editor'));
}),
(req, res)=>{
// TODO: Add a new post
res.send("Claim worked");
}
)
But I get…
The roles are undefined
What am I missing?