微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

node.js – 错误:在会话中找不到请求令牌

我在主要护照回购中发现了一些问题,但是,我认为这主要涉及到这一具体策略,因为我可以使用护照 – google-oauth策略成功验证身份。

Error: Failed to find request token in session
    at Strategy.OAuthStrategy.authenticate (/home/glug/application/node_modules/passport-dropBox/node_modules/passport-oauth/lib/passport-oauth/strategies/oauth.js:124:54)
    at attempt (/home/glug/application/node_modules/passport/lib/passport/middleware/authenticate.js:243:16)
    at Passport.authenticate (/home/glug/application/node_modules/passport/lib/passport/middleware/authenticate.js:244:7)
    at callbacks (/home/glug/application/node_modules/express/lib/router/index.js:161:37)
    at param (/home/glug/application/node_modules/express/lib/router/index.js:135:11)
    at pass (/home/glug/application/node_modules/express/lib/router/index.js:142:5)
    at Router._dispatch (/home/glug/application/node_modules/express/lib/router/index.js:170:5)
    at Object.router (/home/glug/application/node_modules/express/lib/router/index.js:33:10)
    at Context.next (/home/glug/application/node_modules/express/node_modules/connect/lib/proto.js:190:15)
    at Context.actions.pass (/home/glug/application/node_modules/passport/lib/passport/context/http/actions.js:77:8)

我正在使用redis作为会话存储,但是即使在删除之后,仍然会出现相同的错误消息。

var DropBoxStrategy = require('passport-dropBox').Strategy;

app.configure(function(){
  app.set('port',config.express.port);
  app.use(express.favicon());
  app.use(express.logger('dev'));
  app.use(express.bodyParser());
  app.use(express.methodoverride());
  app.use(express.cookieParser());
        app.use(express.session({
//        store: new RedisStore({ client: redis}),secret: config.express.secret
        }));
        app.use(passport.initialize());
        app.use(passport.session());
  app.use(app.router);
});

passport.serializeUser(function(user,done) {
//    console.log('Serializing: ' + JSON.stringify(user));
    done(null,user);
});

passport.deserializeUser(function(obj,done) {
//    console.log('Deserializing: ' + obj);
    done(null,obj);
});

passport.use(new DropBoxStrategy({
    consumerKey: config.dropBox.key,consumerSecret: config.dropBox.secret,callbackURL: config.dropBox.callbackURL
  },function(token,tokenSecret,profile,done) {
    // My storage function
    return done(null,profile);
  }
));

我很高兴尝试任何东西,我已经提交了一个问题的回购,但我认为这可能是我做错了,而不是护照 – 保管箱回购错误

解决方法

叹了口气我忘记了我改变了子域名。所以,因为域名不同,cookie是不可读的。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐