Socket
Socket
Sign inDemoInstall

edit-google-spreadsheet

Package Overview
Dependencies
130
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.17 to 0.2.18

get_oauth2_permissions.js

24

lib/auth.js
var GoogleClientLogin = require('googleclientlogin').GoogleClientLogin;
var GoogleOAuthJWT = require('google-oauth-jwt');
var GoogleOAuthClient = require('googleapis').auth.OAuth2;

@@ -10,2 +11,4 @@ //client auth helper

oauthLogin(opts.oauth, opts.useHTTPS, done);
else if(opts.oauth2)
oAuth2Login(opts.oauth2, done);
else if(opts.accessToken)

@@ -47,2 +50,21 @@ accessTokenLogin(opts.accessToken, done);

function oAuth2Login(oauth2, done ) {
var oAuth2Client = new GoogleOAuthClient(oauth2.client_id, oauth2.client_secret, 'urn:ietf:wg:oauth:2.0:oob');
oAuth2Client.setCredentials({
access_token: 'DUMMY',
expiry_date: 1,
refresh_token: oauth2.refresh_token,
token_type: 'Bearer'
});
oAuth2Client.getAccessToken(function(err, token) {
if (err)
done('Google OAuth2 Error: ' + err);
else
done(null, {type: 'Bearer', token: token });
});
}
function accessTokenLogin(accessToken, done) {

@@ -63,2 +85,2 @@ function gotToken(err, t) {

done("Invalid access token");
}
}

2

lib/spreadsheet.js

@@ -19,3 +19,3 @@ "use strict";

throw "Missing callback";
if (!(opts.username && opts.password) && !opts.oauth && !opts.accessToken)
if (!(opts.username && opts.password) && !opts.oauth && !opts.oauth2 && !opts.accessToken)
return callback("Missing authentication information");

@@ -22,0 +22,0 @@ if (!opts.spreadsheetId && !opts.spreadsheetName)

{
"name": "edit-google-spreadsheet",
"version": "0.2.17",
"version": "0.2.18",
"dependencies": {

@@ -8,2 +8,3 @@ "async": "^0.9.0",

"google-oauth-jwt": "0.0.4",
"googleapis": "2.0.4",
"googleclientlogin": "~0.2.6",

@@ -10,0 +11,0 @@ "lodash": "^2.4.1",

## Edit Google Spreadsheet
---
:warning: Google has finally deprecated Client Logins, which means you can no longer authenticate with your email and password. See https://github.com/jpillora/node-edit-google-spreadsheet/issues/72 for updates.
---
> A simple API for reading and writing Google Spreadsheets in Node.js

@@ -26,8 +32,6 @@

// Choose from 1 of the 4 authentication methods:
// 1. Username and Password
username: 'my-name@google.email.com',
password: 'my-5uper-t0p-secret-password',
// Choose from 1 of the 5 authentication methods:
// 1. Username and Password has been deprecated
// OR 2. OAuth

@@ -39,3 +43,10 @@ oauth : {

// OR 3. Static Token
// OR 3. OAuth2
oauth2: {
client_id: 'generated-id.apps.googleusercontent.com',
client_secret: 'generated-secret',
refresh_token: 'token generated with get_oauth2_permission.js'
},
// OR 4. Static Token
accessToken: {

@@ -46,3 +57,3 @@ type: 'Bearer',

// OR 4. Dynamic Token
// OR 5. Dynamic Token
accessToken: function(callback) {

@@ -49,0 +60,0 @@ //... async stuff ...

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc