Microsoft Graph API access is denied. check credentials and try again

Microsoft Graph API access is denied. check credentials and try again

Play this article

When working with Microsoft Graph API I came across this error Access is denied. Check credentials when trying to send email, even though I could see my email using the API.

I was using the scope mail.readwrite turns out that does not cover sending emails for that you also need to mail.send scope.