"ErrorAccessDenied" usually occurs when generated token does not have sufficient permissions or the consented permission are not granted by Admin. As per the documentation Mail.ReadBasic.All, Mail.Read Permissions (from least to most privileged) is required to run the above Graph API endpoint.
Please make sure you have the above permissions in your token. You can check your permissions by decoding your token using Jwt.io.
Hope this helps.
If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.