'MS Graph API 403 error when calling users even access is granted

I am generating access token by the following route in my node.js

https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/token

After that I get access_token but no scope parameter.

When i try to hit the https://graph.microsoft.com/v1.0/users?$filter=startswith(givenName,'J') url with Authorization Header added i get

{
    "error": {
        "code": "Authorization_RequestDenied",
        "message": "Insufficient privileges to complete the operation.",
        "innerError": {
            "date": "2022-05-13T18:10:19",
            "request-id": "7086d829-13c1-4671-8bd4-9f365aa29417",
            "client-request-id": "7086d829-13c1-4671-8bd4-9f365aa29417"
        }
    }
}

Even though I have granted permissions and admin consent.

I would really appreciate any help.

PS(I have owner access to the app and AAD)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source