假如你的地址是https://xxx,你在这个地址发请求访问微信的接口https://open.weixin.com 当然跨域了,所以正确的做法是window.location.href = https://open.weixin.com, 然后redirect_uri=https://xxx
网页授权出现跨域问题,域名已经在公众平台配置XMLHttpRequest cannot load https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx1b63f19b557665ec&redirect_uri=https%3A%2F%2Factivitygray.motivape.cn%2F%23%2Ffriends_index%3Fopenid%3D%26channelType%3D0&response_type=code&scope=snsapi_userinfo&state=?openid=&channelType=0#wechat_redirect. Redirect from 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx1b63f19b557665ec&redirect_uri=https%3A%2F%2Factivitygray.motivape.cn%2F%23%2Ffriends_index%3Fopenid%3D%26channelType%3D0&response_type=code&scope=snsapi_userinfo&state=?openid=&channelType=0#wechat_redirect' to 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx1b63f19b557665ec&redirect_uri=https%3A%2F%2Factivitygray.motivape.cn%2F%23%2Ffriends_index%3Fopenid%3D%26channelType%3D0&response_type=code&scope=snsapi_userinfo&state=?openid=&channelType=0&connect_redirect=1#wechat_redirect' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://activitygray.motivape.cn' is therefore not allowed access. [图片]
2021-07-02