正在显示
2 个修改的文件
包含
14 行增加
和
9 行删除
| ... | ... | @@ -13,17 +13,22 @@ module.exports = app => { |
| 13 | 13 | config.clientSecret = config.secret; |
| 14 | 14 | |
| 15 | 15 | // must require `req` params |
| 16 | - app.passport.use('dingtalk', new Strategy(config, (req, token, tokenSecret, params, profile, done) => { | |
| 16 | + app.passport.use('dingtalk', new Strategy(config, (req, accessToken, refreshToken, results, profile, done) => { | |
| 17 | 17 | // format user |
| 18 | + const jsonInfo = profile._json || {}; | |
| 18 | 19 | const user = { |
| 19 | 20 | provider: 'dingtalk', |
| 20 | 21 | id: profile.id, |
| 21 | - name: profile.username, | |
| 22 | - displayName: profile.displayName, | |
| 23 | - photo: profile.photos && profile.photos[0] && profile.photos[0].value, | |
| 24 | - token, | |
| 25 | - tokenSecret, | |
| 26 | - params, | |
| 22 | + unionId:jsonInfo.unionId, | |
| 23 | + privateId:profile.privateId, | |
| 24 | + name: profile.name, | |
| 25 | + mobile: profile.mobile, | |
| 26 | + nick:jsonInfo.nick, | |
| 27 | + email:jsonInfo.email, | |
| 28 | + avatarUrl:jsonInfo.avatarUrl|| profile.headurl, | |
| 29 | + accessToken, | |
| 30 | + refreshToken, | |
| 31 | + results, | |
| 27 | 32 | profile, |
| 28 | 33 | }; |
| 29 | 34 | debug('%s %s get user: %j', req.method, req.url, user); | ... | ... |
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | * @property {String} SOME_KEY - some description |
| 7 | 7 | */ |
| 8 | 8 | exports.passportDingtalk = { |
| 9 | - key: 'dingkuvhxslusd5hkjem', | |
| 10 | - secret: 'Eyv_4w3DtafgN0b-EuHDWC0aty1RfOq55pJlBMiKkL64iNSF67AtU3aBcJNM-0ds', | |
| 9 | + key: 'xxxxx', | |
| 10 | + secret: 'xxxxx', | |
| 11 | 11 | callbackURL: '/callback/dingtalk', |
| 12 | 12 | }; | ... | ... |
请
注册
或
登录
后发表评论