微信公众号开发获取openid时的跨域问题

本来很简单的一件事情,结果遇上了跨域。。
接触过微信开发的应该知道,获取openid的时候,有一步是这样的:
点击公众号菜单
进入h5页面获得code

clipboard.png(菜单链接)
,然后在请求 "https://api.weixin.qq.com/sns/oauth2/access_token"
然后,就跨域了。我设置了回调域名
clipboard.png

提示是这样的:
XMLHttpRequest cannot load https://open.weixin.qq.com/co... No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://test.xxxx.com' is therefore not allowed access.

阅读 10.2k
1 个回答

是你哪里配置有问题

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题