如何从vkontakte获取长期访问令牌?

时间:2014-11-06 10:56:28

标签: javascript node.js passport.js vk

我使用护照js来验证我的node.js应用程序中的人员。在vkontakte的情况下,我获得了有效期仅一天的访问令牌?这是我的代码

passport.use(new VKontakteStrategy({clientID: '******',clientSecret: '********',callbackURL: "http://example.com/signin/vkontakte/callback",profileFields:     ['notify','friends','photos','notes','pages','offers','questions','wall','messages','offline']},
function (accessToken, refreshToken, profile, done) {
    process.nextTick(function () {
        console.log('vk profile: '+util.inspect(profile));
        console.log('refresh Token: '+refreshToken);
        profile.accessToken = accessToken.toString();
        return done(null, profile);
    });
}

)); ` 有没有办法增加有效期?帮助赞赏。提前谢谢。

1 个答案:

答案 0 :(得分:6)

在令牌请求中设置scope = offline