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