Skip to content

khemlabs/nodejs-gmail-api-credentials-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gmail API credentials

This nodejs app helps you to generate valid gmail api credentials

Official documentation and original code

Run APP

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

Environment variables

  • SCOPE: comma separated values
  • CLIENT_SECRET_PATH: path to the credentials file [defaulf: ./client_secret.json]

Download file with client_id and client_secret

  1. 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
  1. 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]
  1. Step three: Click in cancel
You should be in https://console.developers.google.com/apis/credentials?showWizardSurvey=true&project=[project_name]
  1. Step four: Click in create credentials
  2. Step five: Click in oauth credentials
  3. Step five: Click in other
  4. Step five: Download file selecting it from credentials table

Use credentials with nodemailer

var nodemailer = require("nodemailer");

var transporter = nodemailer.createTransport({
    service: "gmail",
    auth: {
        type: "OAuth2",
        user: '[email protected],
        clientId: "clientId",
        clientSecret: "clientSecret",
        refreshToken: "refreshToken"
    }
});

About

nodejs-gmail-api-credentials-generator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published