I am trying to authenticate with Google via OAuth2, and I'm using the googleapis NPM package . To do this, I am creating a small local package to use in my project:
Package.js
Npm.depends ({"googleapis": "2.0.1"}); Package.describe ({name: 'google-tokens', summary: 'library for request of Google API token', version: '0.0.1'}); Packejkon (function (API) {Apiaikyues ([ 'underscore', 'http', 'Service-configuration' 'Oath' accounts-Oath '], [' client ',' server ']); Api.addFiles ('lib / tokens_client.js', 'customer'); api.addFiles ('lib / tokens_server.js', 'server'); api.export (['token']);});
tokens_server.js (package)
token = (function () {Google = Npm.require ('googleapis'); OAuth2Client = Google.auth .OAuth2; var my = {}; my.fetchTokens = function (code) {var clientid = Meteor.settings.google.CLIENT_ID; var clientSecret = Meteor.settings.google.CLIENT_SECRET; var redirect = Meteor.settings.google.REDIRECT_URL ; oauth2Client = OAuth2Client (clientid, clientSecret, redirect); var response = Async.runSync (function (a) {Oauth2ClientkgetToken (address, function (the error token) {error (token);});}); Console.log (feedback); return response;}; ....
However, the above code returns
Debate exception while Method 'Aedcanl' typos could undefined not set I20150316-23 property 'Transporter': 33 :? 03.520 (1) AuthClient (at / Users / madsh / Programming / Projects / youtubr / packages / Google-tokens / .npm / package / node_modules / goog leapis / node_modules / google-auth-library / lib / auth / authclient.js: 25: 20) I20150316-23: 33: 03.520 (1)? OAuth2Client (/Users/madsh/Programming/Projects/youtubr/packages/google-tokens/.npm/package/node_modules/googleapis/node_modules/google-auth-library/lib/auth/oauth2client.js:38:23) on I20150316 -23: 33: 03.520 (1)? On Object.my.fetchTokens (packages / Google- token / lib / tokens_server.js: 11: 1)
Which referes part within node_modules folder .npm / package / Node_modules / googleapis folder, which includes
'strict use'; Var DefaultTransporter = Required ('../ transporters.js'); / ** * Auth class for customer authentication * / function AuthClient () {this.transporter = new DefaultTransporter (); & Lt; ---------- Failure line} / ** * Export AuthClient * / Module.exports = AuthClient;
I do not know why this is happening, any advice?
You should make an example as an example client, that is,
< Code> var client = new Oauth2Client (...
No comments:
Post a Comment