Passport for 微信小程序
Passport strategy for authenticating with Wechat Mini Program
微信小程序 | 微信小程序体验版 |
---|---|
- 微信小程序登录
$ npm install passport-weapp
passport.use(new WeappStrategy({
appID: {APPID},
name:{默认为wechat,可以设置组件的名字}
appSecret: {APPSECRET},
getToken: {getToken},
saveToken: {saveToken}
},
function(accessToken, refreshToken, profile,expires_in, done) {
return done(err,profile);
}
));
The `getToken` and `saveToken` can be provided to initialize Wechat OAuth instance.
router.get("/auth/weapp", passport.authenticate("weapp", options));
options
- Optional. Can include the following:
state
- Override state for this specific API callcallbackURL
- Override callbackURL for this specific API callscope
- Override scope for this specific API call
If no callbackURL is specified, the same request url will be used.
Copyright (c) 2019 jeff-tian
Licensed under the MIT license.