Reputation: 1869
I've followed this tutorial and the emails are sent perfectly as long as the access and refresh tokens are alive
As the code should serve production how can I keep these tokes from expiring? or how can I fetch new tokens before sending the email?
Upvotes: 1
Views: 1233
Reputation: 4419
The OAuth Playground will automatically revoke refresh tokens after 24h. You can avoid this by specifying your own application OAuth credentials using the Configuration panel.
In order to understand how to create your own app's credentials instead of the OAuthPlayground's I suggest you follow the Node.js Gmail API quickstart.
The refresh token will be in the credentials object.
Upvotes: 3