passport-qyweixin

0.1.5 • Public • Published

passport-qyweixin v1.0.3

支持功能

  • 企业微信登录

安装

$ npm install passport-qyweixin

使用

Configure Strategy

 
 passport.use(new QYStrategy({
        appID: {APPID}, // corpid
        agentID: {agentID},
        secretKey: {secretKey}, // corpsecret
        state: {state} || 'login' // 默认 login
        redirectUrl: {redirectUrl},
        getuserdetail: {getuserdetail} || false // 获取用户相信信息
        passReqToCallback: {passReqToCallback} || false // 默认false
      },
      function(user, done) {
          if (user && user.userid) {
              done(null, user)
          } else {
              done(null, false)
          }
      }
));
 

Authenticate Requests

  router.get('/auth/xx', passport.authenticate('hlg', {
    failureRedirect: '/auth/fail',
    successReturnToOrRedirect: '/'
  }));

If no callbackURL is specified, the same request url will be used.

Authentication Callback

  router.get('/auth/wechat/hlg', passport.authenticate('hlg', {
    failureRedirect: '/auth/fail',
    successReturnToOrRedirect: '/'
  }));

License

Copyright (c) 2016 Sharkseven
Licensed under the MIT license.

Package Sidebar

Install

npm i passport-qyweixin

Weekly Downloads

0

Version

0.1.5

License

MIT

Unpacked Size

7.91 kB

Total Files

4

Last publish

Collaborators

  • sharkseven