首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >NodeJs,500未能在process._tickCallback (node.js:419:13)处获得访问令牌(错误:连接ECONNREFUSED)

NodeJs,500未能在process._tickCallback (node.js:419:13)处获得访问令牌(错误:连接ECONNREFUSED)
EN

Stack Overflow用户
提问于 2014-11-06 13:30:48
回答 1查看 1.5K关注 0票数 2

我使用护照GoogleStrategy对用户进行身份验证,但我得到的错误如下。你能帮帮我吗?

代码语言:javascript
复制
passport.use(new GoogleOAuth2Strategy({
        clientID : configAuth.googleAuth.clientID,
        clientSecret: configAuth.googleAuth.clientSecret,
        callbackURL: configAuth.googleAuth.callbackURL,
        scope: ['profile', 'email', 'openid'],
        passReqToCallback   : true
    },


function(token, refreshToken, profile, done) {
    // User.findOne won't fire until we have all our data back from Google 

    process.nextTick(function() {
        console.log(profile.id);
        User.findOne({ 'google.id' : profile.id }, function(err, user) {
            if (err)
                return done(err);
            if (user) {                
                return done(null, user);
            } else {                   
                var newUser          = new User();                  
                newUser.google.id    = profile.id;
                newUser.google.token = token;
                newUser.google.name  = profile.displayName;
                newUser.google.email = profile.emails[0].value;                 
                console.log(profile.id);
                console.log(token);
                console.log(profile.displayName);
                console.log(profile.emails[0].value);

                // save the user
                newUser.save(function(err) {
                    if (err)
                        throw err;
                    return done(null, newUser);
                });
            }
        });
    });

错误日志

500未能在D:\Chandrasekhar\NodeJs_Workspace\SkillsetMgmtNode\node_modules\passport-google-oauth\node_modules\passport-oauth\lib\passport-oauth\strategies\oauth2.js:125:38 at D:\Chandrasekhar\NodeJs_Workspace\SkillsetMgmtNode\node_modules\passport-google-oauth\node_modules\passport-oauth\node_modules\oauth\lib\oauth2.js:177:18 at ClientRequest获得访问令牌(错误:连接ECONNREFUSED)。(D:\Chandrasekhar\NodeJs_Workspace\SkillsetMgmtNode\node_modules \passport-google-oauth\node_modules\passport-oauth\node_modules\oauth\lib\oauth2.js:148:5)

EN

回答 1

Stack Overflow用户

发布于 2016-06-27 08:12:16

我也犯了同样的错误。对我来说,错误是因为我支持一个代理。在没有代理的情况下运行时,代码工作正常。所以试一次这个。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26780760

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档