javascript - TypeError: object is not a function (Node js) -


sorry have question node.js. have project oauth2 , want make post request.

exports.acceptedlog = function (req, res) { request({     method:'post',     uri:'https://10.10.121.94:3000/oauth/access?grant_type=password&username=sana&password=issam' }, function (err, response, body) {      if (err) {          res.write(err);         res.end();      } else {          console.log("there's no error");           /*         var token = json.parse(response.body);           if (typeof(token.access_token) == "undefined") {             res.redirect("https://10.10.121.94:3000/badaccess");         } else {             res.redirect('https://10.10.121.94:3000/protectedresource?accesstoken=' + token.access_token);         }         */     } }); 

}

and in oauth2.js

exports.access = server.exchange(oauth2orize.exchange.password(function(username, password, scope, done) { console.log("i'm here");   db.accesstokens.create(client, username, password, scope, function(err, accesstoken) {     if (err) {         return done(err);     }     done(null, accesstoken); }); 

}));

problem have error:

typeerror: object not function     @ callbacks (/users/hammouayoub/documents/pinchproject/repo local/sample/oauth2orizev0.0.3/oauth2orize-master/examples/express2/node_modules/express/lib/router/index.js:272:11)     @ param (/users/hammouayoub/documents/pinchproject/repo local/sample/oauth2orizev0.0.3/oauth2orize-master/examples/express2/node_modules/express/lib/router/index.js:246:11)     @ pass (/users/hammouayoub/documents/pinchproject/repo local/sample/oauth2orizev0.0.3/oauth2orize-master/examples/express2/node_modules/express/lib/router/index.js:253:5)     @ router._dispatch (/users/hammouayoub/documents/pinchproject/repo local/sample/oauth2orizev0.0.3/oauth2orize-master/examples/express2/node_modules/express/lib/router/index.js:280:5)     @ object.middleware [as handle] (/users/hammouayoub/documents/pinchproject/repo local/sample/oauth2orizev0.0.3/oauth2orize-master/examples/express2/node_modules/express/lib/router/index.js:45:10)     @ context.next (/users/hammouayoub/documents/pinchproject/repo local/sample/oauth2orizev0.0.3/oauth2orize-master/examples/express2/node_modules/express/node_modules/connect/lib/http.js:204:15)     @ context.actions.pass (/users/hammouayoub/documents/pinchproject/repo local/sample/oauth2orizev0.0.3/oauth2orize-master/examples/express2/node_modules/passport/lib/passport/context/http/actions.js:77:8)     @ sessionstrategy.authenticate (/users/hammouayoub/documents/pinchproject/repo local/sample/oauth2orizev0.0.3/oauth2orize-master/examples/express2/node_modules/passport/lib/passport/strategies/session.js:52:10)     @ attempt (/users/hammouayoub/documents/pinchproject/repo local/sample/oauth2orizev0.0.3/oauth2orize-master/examples/express2/node_modules/passport/lib/passport/middleware/authenticate.js:246:16)     @ passport.authenticate (/users/hammouayoub/documents/pinchproject/repo local/sample/oauth2orizev0.0.3/oauth2orize-master/examples/express2/node_modules/passport/lib/passport/middleware/authenticate.js:247:7) 

i don't understand. , if console.log in method(oauth2orize.exchange.password(function(username, password, scope, done)

i have nothing, can me please ?


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -