0.0.5 • Published 7 years ago
egg-passport-weixin v0.0.5
egg-egg-passport-weixin
Install
$ npm i egg-passport-weixin --save
Usage
// {app_root}/config/plugin.js
exports.passportWeixin = {
enable: true,
package: 'egg-passport-weixin',
};
Configuration
// {app_root}/config/config.default.js
exports.passportWeiXin = {
clientID: '',
secret: '',
callbackURL: '/auth/weixin/callback',
scope:'snsapi_userinfo',
};
see config/config.default.js for more detail.
Example
// {app_root}/app/router.js
app.get("/auth/weixin", app.passport.authenticate('loginByWeixinClient'));
app.get("/auth/weixin/callback",app.passport.authenticate('loginByWeixinClient',{ successRedirect: '/test/hello',failureRedirect: '/login' })
);
Questions & Suggestions
Please open an issue here.