Nominal Pizza Masticator
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    oauth-gmailpublic

    gmail-oauth

    OAuth for Gmail

    This module makes it easy to generate Oauth (v1) and Xoauth strings for use with gmail's IMAP servers.

    Installation

    $ npm install gmail-oauth
    

    API

    var client = require(__dirname + '../lib/index').createClient();
    
    client.getRequestToken('johnnytoothpick@gmail.com', function (error, results) {
      if (error) 
        throw new Error(error);
    
      // get the user to go to the authorization URL...
    
      process.stdin.resume();
      process.stdin.setEncoding('utf8');
      process.stdout.write('Enter verification code: ');
    
      process.stdin.once('data', function (text) {
        var code = text.trim();
      
        client.getAccessToken(results, code, function(error, results) {
          if (error)  
            throw new Error(error);
     
          console.log(JSON.stringify(results, null, 2));
        });
      });
    });
    

    GmailOauth API

    gmailOauth.createClient([options]);

    Create a new oauth client.

    options is an object which may specify:

    • consumerKey: the consumerKey value to pass to Gmail/Google
    • consumerSecret: the consumerSecret value to pass to Gmail/Google
    • callbackUrl: which callbackUrl to use for this client. Defaults to 'oob'

    Class: gmailOauth.client;

    client.getRequestToken(user, callback)

    client.getAccessToken(request, verifier, callback)

    client.xoauthString(user, accessToken, accessTokenSecret)

    Keywords

    none

    install

    npm i oauth-gmail

    Downloadsweekly downloads

    7

    version

    0.0.2

    license

    none

    repository

    githubgithub

    last publish

    collaborators

    • avatar