This nodejs app helps you to generate valid gmail api credentials
Official documentation and original code
node index.js
- You need to download the credential JSON file from Google.
- The app will create a file with the tokens at ~/.credentials/gmail-nodejs-quickstart.json
- SCOPE: comma separated values
- CLIENT_SECRET_PATH: path to the credentials file [defaulf: ./client_secret.json]
- Step one: Create or select a proyect in HERE
You should see a select input, where you can select previous projects or create a new one
- Step two: Click in go to credentials button
You should be in https://console.developers.google.com/apis/credentials/wizard?api=gmail.googleapis.com&project=[project_name]
- Step three: Click in cancel
You should be in https://console.developers.google.com/apis/credentials?showWizardSurvey=true&project=[project_name]
- Step four: Click in create credentials
- Step five: Click in oauth credentials
- Step five: Click in other
- Step five: Download file selecting it from credentials table
var nodemailer = require("nodemailer");
var transporter = nodemailer.createTransport({
service: "gmail",
auth: {
type: "OAuth2",
user: '[email protected],
clientId: "clientId",
clientSecret: "clientSecret",
refreshToken: "refreshToken"
}
});