Issue: OAuth2 Access Token not Being Generated for Gmail
I am trying to use an SMTP library to send mail via Gmail. To do this, I need to generate an OAuth2 access token. I have set up an OAuth2 client account in the Google API console, enabled the Gmail API, and added the https://mail.google.com/
scope in the OAuth consent screen setup. However, when I make a POST request to https://accounts.google.com/o/oauth2/device/code, I get the error invalid_scope
. When I switch the scope to email
, the request goes through. I have tested this with two different HTTP clients to make sure this wasn’t due to some encoding issue.
What am I doing wrong?