| 123456789101112131415161718192021 |
- //公众号ID
- const appId = 'wx322e246549d7620d';
- //公众号密钥
- const appSecret = '118059d75bc8c1a08162fc8a8cf5ac04';
- //经过编码后的回调地址
- const redireactUrl = 'https://music.nanyue6688.com/vote-h5/index.html#/';
- //获取用户授权信息Code
- 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`};
- //获取用户的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};
|