Showing
7 changed files
with
18 additions
and
12 deletions
@@ -14,11 +14,11 @@ const config = require('../../config/common'); | @@ -14,11 +14,11 @@ const config = require('../../config/common'); | ||
14 | * wechat登录 | 14 | * wechat登录 |
15 | */ | 15 | */ |
16 | passport.use(new WeixinStrategy({ | 16 | passport.use(new WeixinStrategy({ |
17 | - clientID: config.wechat.appID, | ||
18 | - clientSecret: config.wechat.appSecret, | 17 | + clientID: config.thirdLogin.wechat.appID, |
18 | + clientSecret: config.thirdLogin.wechat.appSecret, | ||
19 | callbackURL: `${config.siteUrl}/passport/login/wechat/callback`, | 19 | callbackURL: `${config.siteUrl}/passport/login/wechat/callback`, |
20 | requireState: false, | 20 | requireState: false, |
21 | scope: 'snsapi_userinfo' | 21 | scope: 'snsapi_userinfo' |
22 | }, (accessToken, refreshToken, profile, done) => { | 22 | }, (accessToken, refreshToken, profile, done) => { |
23 | done(null, profile); | 23 | done(null, profile); |
24 | -})); | ||
24 | +})); |
@@ -15,6 +15,10 @@ class Auth { | @@ -15,6 +15,10 @@ class Auth { | ||
15 | method: 'app.passport.signinByOpenID' | 15 | method: 'app.passport.signinByOpenID' |
16 | }; | 16 | }; |
17 | 17 | ||
18 | + if (shoppingKey) { | ||
19 | + param.shopping_key = shoppingKey; | ||
20 | + } | ||
21 | + | ||
18 | return api.get('', sign.apiSign(param)); | 22 | return api.get('', sign.apiSign(param)); |
19 | } | 23 | } |
20 | 24 | ||
@@ -44,4 +48,4 @@ class Auth { | @@ -44,4 +48,4 @@ class Auth { | ||
44 | } | 48 | } |
45 | } | 49 | } |
46 | 50 | ||
47 | -module.exports = Auth; | ||
51 | +module.exports = Auth; |
@@ -15,4 +15,4 @@ const router = express.Router(); // eslint-disable-line | @@ -15,4 +15,4 @@ const router = express.Router(); // eslint-disable-line | ||
15 | router.get('/login/wechat', login.wechat.beforeLogin, login.wechat.login); // 登录 | 15 | router.get('/login/wechat', login.wechat.beforeLogin, login.wechat.login); // 登录 |
16 | router.get('/login/wechat/callback', login.wechat.callback); | 16 | router.get('/login/wechat/callback', login.wechat.callback); |
17 | 17 | ||
18 | -module.exports = router; | ||
18 | +module.exports = router; |
@@ -48,9 +48,11 @@ module.exports = { | @@ -48,9 +48,11 @@ module.exports = { | ||
48 | prettyPrint: true | 48 | prettyPrint: true |
49 | } | 49 | } |
50 | }, | 50 | }, |
51 | - wechat: { | ||
52 | - appID: 'wx3ae21dcbb82ad672', | ||
53 | - appSecret: 'e78afb2321e6a19085767e1a0f0d52c1' | 51 | + thirdLogin: { |
52 | + wechat: { | ||
53 | + appID: 'wx3ae21dcbb82ad672', | ||
54 | + appSecret: 'e78afb2321e6a19085767e1a0f0d52c1' | ||
55 | + } | ||
54 | } | 56 | } |
55 | }; | 57 | }; |
56 | 58 | ||
@@ -76,4 +78,4 @@ if (isProduction) { | @@ -76,4 +78,4 @@ if (isProduction) { | ||
76 | useOneapm: true, | 78 | useOneapm: true, |
77 | useCache: true | 79 | useCache: true |
78 | }); | 80 | }); |
79 | -} | ||
81 | +} |
-
Please register or login to post a comment