小程序access_token api 跨域问题blocked by CORS 如何解决?

小游戏 企业微信 微信支付 小程序 文章 2020-07-30 21:24 1257 0 全屏看文

AI助手支持GPT4.0

小程序access_token api 跨域问题blocked by CORS 如何解决?

在用云开发 web sdk 开发小程序后台。当去获取access_token时,显示blocked by CORS

GET https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET

In the cloud development of Web SDK development small program background. When to get access_ When token is displayed, blocked by CORS get is displayed https://api.weixin.qq.com/cgi-bin/token?grant_ type=client_ credential&appid=APPID&secret=APPSECRET

回答:

ray:

后端请求

吃鱼先生:

不管会不会跨域,都不要用前端去请求api.weixin.qq.com,

因为你请求的时候会带上敏感信息,比如secret之类的,

secret泄露是一个很严重的事情

-EOF-

AI助手支持GPT4.0