config.js 913 B

1234567891011121314
  1. //公众号ID
  2. const appId = 'wx7e7a38f071b360e9';
  3. //公众号密钥
  4. const appSecret = '4e862f91b48ac85a91380fa0991c9fda';
  5. //经过编码后的回调地址
  6. const redireactUrl = 'https://vote.guosen-fumao.cn/vote-h5/index.html#/pages/home/home';
  7. //获取用户授权信息Code
  8. const authUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${encodeURIComponent(redireactUrl)}&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) =>{ return `https://api.weixin.qq.com/sns/userinfo?access_token=${ACCESS_TOKEN}&openid=${OPENID}&lang=zh_CN`}
  13. export { appId , authUrl ,atUrl,getWXUserInfoUrl };