I have a simple GraphQL implementation using HotChocolate v13 where several resolvers are protected by Authorize HotChocolate implementation and as soon as a JWT token is passed for an Azure AD user, it works fine.
Now I have a function that needs to invoke a query from the GraphQL endpoint using a JWT obtained by using the function Managed Identity resulting in a response like the one below:
{
"errors": [
{
"message": "The current user is not authorized to access this resource.",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"me"
],
"extensions": {
"code": "AUTH_NOT_AUTHORIZED"
}
}
]
}
Same GraphQL api has other regular Controllers but protected by asp.net Core [Authorize] attribute and invoking them with the Managed Identity JWT token works fine.
Why is that happening? meaning JWT obtained via Managed Identity approach does not work with HotChocolate GraphQL?