access_token不存在于passport-github2请求中

我已经通过我的Github帐户注册了一个OAuth应用程序。 我基本上试图授权我的node请求(通过发送access_token作为请求cookie的一部分),所以我可以访问另一台服务器上的几个API。 因此我使用github-passport2软件包。 我已经设置了Github策略等等,似乎都是根据文档。 stream程也运作良好。

我的问题

login到Github(授权)并redirect回到我的/auth/github/callback理想情况下应该被授权,并且在req应该有一个access_token 但我没有! 因此,我无法使用access_token来授权我未来的请求。

需要注意的是,当从浏览器/客户端(使用withCredentials: true参数)发起请求时,此access_token自动附加。 通过节点相同的access_token似乎不可检索。

 passport.use(new GitHubStrategy({ clientID: GITHUB_CLIENT_ID, clientSecret: GITHUB_CLIENT_SECRET, callbackURL: "http://localhost:8080/auth/github/callback", }, function(accessToken, refreshToken, profile, done) { // asynchronous verification, for effect... process.nextTick(function () { return done(null, profile); }); } )); app.get('/auth/github', passport.authenticate('github', { scope: [ 'user:email' ] }), function(req, res){ // The request will be redirected to GitHub for authentication, so this // function will not be called. }); app.get('/auth/github/callback', passport.authenticate('github', { failureRedirect: '/login' }), function(req, res) { console.log(req); // <- This ideally should have the access_token? but doesn't }); 

我在这方面挣扎了好几天。 任何帮助深表感谢。