config.js 922 B

123456789101112131415161718192021
  1. //公众号ID
  2. const appId = 'wx322e246549d7620d';
  3. //公众号密钥
  4. const appSecret = '118059d75bc8c1a08162fc8a8cf5ac04';
  5. //经过编码后的回调地址
  6. const redireactUrl = 'https://music.nanyue6688.com/vote-h5/index.html#/';
  7. //获取用户授权信息Code
  8. const authUrl = (path) => { return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${encodeURIComponent(redireactUrl+path)}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`};
  9. //获取用户的Access-token
  10. const atUrl = (code) => { return `https://api.weixin.qq.com/sns/oauth2/access_token?appid=${appId}&secret=${appSecret}&code=${code}&grant_type=authorization_code`}
  11. //拉取用户信息
  12. const getWXUserInfoUrl = (ACCESS_TOKEN, OPENID) => {
  13. return `https://api.weixin.qq.com/sns/userinfo?access_token=${ACCESS_TOKEN}&openid=${OPENID}&lang=zh_CN`
  14. }
  15. export {appId, authUrl, atUrl, getWXUserInfoUrl};