Setup
You can authenticate via two methods:- Provide an access token, obtained via OAuth2 token exchange, to the credentials object. This can be a string or a function so that token expiry and validation can be handled. This can be done using an Identity Provider that supports getting access tokens from federated connections. This is the most secure method as the access and scope will be limited to the specific end user. This method will be more appropriate when using the tool in an application that is meant to be used by end users with their own Gmail account.
- You will need to get an API key from Google here
and enable the new Gmail API.
Then, set the environment variables for
GMAIL_CLIENT_EMAIL
, and eitherGMAIL_PRIVATE_KEY
, orGMAIL_KEYFILE
.
npm
Usage
Related
- Tool conceptual guide
- Tool how-to guides