简体   繁体   中英

How to get long lived access token from vkontakte?

I am using passport js for authenticating people in my node.js application. In case of vkontakte I got the access token which is valid for just one day? here is my code

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);
    });
}

)); ` Is there a way to increase the validity period? Help appreciated. Thanks in advance.

在令牌请求中设置scope = offline

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM