there is a great explanation of how to setup your google developer account at:
https://www.emailarchitect.net/easendmail/ex/b/20.aspx

and from google at:
https://support.google.com/googleapi/answer/7037264?hl=en&ref_topic=7013279

in summary
--------------
In order to make this code work you will need to create a google developer account. 

Then you create a project and create an app client id.

From there access your app console and enable GMail apis.
 
Click on Create Credentials and create an OAuth Credentials, set the app type to "Web Application" and
make sure to set your redirect url and PORT for oauth as follows:
http://localhost:8888  
(do not use https://  - only http://)

IMPORTANT!
download the credential file to this apps folder and rename it to "env.json" before running the program
it is a small download link at the end of the Oauth 2 entry in the app console.

click on "launch oauth browser" to start the token auth process

After you get the User token you can send an email