Example #1
0
function oauthLogin(oauth, useHTTPS, done) {

  if(!oauth.scopes)
    oauth.scopes = ['http'+useHTTPS+'://spreadsheets.google.com/feeds'];

  GoogleOAuthJWT.authenticate(oauth, function (err, token) {
    if(err)
      done("Google OAuth Error: " + err);
    else
      done(null, {type : 'Bearer', token :  token});
  });
}
exports.prototype.connect = function(callback, error_callback) {
	var self = this;
	
	google_oauth.authenticate({
        email: self.config.email,
        keyFile: self.config.key_file,
        scopes: self.config.scopes
    }, function (err, token) {
		self.use_callback_or_error(err, callback, error_callback, function() {
			self.config.current_token = token;
		});
	});
};