webview打开公众号,无法获取授权code
使用wx.request向后端发起请求获取code,报错 "请在微信客户端打开链接",请问如何解决 本人是在微信开发者工具上进行调试的。操作流程->小程序->内嵌公众号 webview页面onload时候调用wx.request请求后端公众号获取code接口 发起的请求如下 https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb840e998553389f7&redirect_uri=https%3A%2F%2Fwx.yaojy.cn%2Fwxlogin%2Fcallback&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect 被301重定向后url如下 https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb840e998553389f7&redirect_uri=https%3A%2F%2Fwx.yaojy.cn%2Fwxlogin%2Fcallback&response_type=code&scope=snsapi_base&state=STATE&connect_redirect=1 返回 <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0"> </head> <body> <script type="text/javascript"> var ua = navigator.userAgent.toLowerCase(); var isWeixin = ua.indexOf('micromessenger') != -1; var isAndroid = ua.indexOf('android') != -1; var isIos = (ua.indexOf('iphone') != -1) || (ua.indexOf('ipad') != -1); if (!isWeixin) { document.head.innerHTML = 'https://res.wx.qq.com/open/libs/weui/0.4.1/weui.css">'; document.body.innerHTML = '<div class="weui_msg"><div class="weui_icon_area"><i class="weui_icon_info weui_icon_msg"></i></div><div class="weui_text_area"><h4 class="weui_msg_title">请在微信客户端打开链接</h4></div></div>'; } </script> </body> </html>