iframe 中嵌入使用微信登录的第三方站点,授权登录后无法跳转
发布于 4 年前 作者 yang33 618 次浏览 来自 问答

页面 www.host.com 在iframe中,嵌入了第三方的站点链接

https://oa.m.xx.com/an:ntsapps/case_mobile/main/csgl_case-front/case-detail?id=cf21341b28da415693319c038cf1999f&isQuestionnaire=1

改链接使用微信登录,在微信中访问www.host.com时,会唤起微信登录,授权后,无法跳转到第三方站点。

网络工具中,记录到的网络请求有两次:

第一次

Request URL: https://open.weixin.qq.com/connect/oauth2/authorize?appid=appid&redirect_uri=https%3a%2f%2foa.m.xx.com%2fan%3antsapps%2f__login%2f%3fp%3dhttps%253a%252f%252foa.m.xx.com%252fan%253antsapps%252fcase_mobile%252fmain%252fcsgl_case-front%252fcase-detail%253fid%xxx%2526isQuestionnaire%253d1&response_type=code&scope=snsapi_base&state=mpauth
Request Method: GET
Status Code: 301 Moved Permanently (from disk cache)
Remote Address: 101.89.15.204:443
Referrer Policy: strict-origin-when-cross-origin
Content-Length: 0
Location: https://open.weixin.qq.com/connect/oauth2/authorize?appid=appid&redirect_uri=https%3a%2f%2foa.m.xx.com%2fan%3antsapps%2f__login%2f%3fp%3dhttps%253a%252f%252foa.m.xx.com%252fan%253antsapps%252fcase_mobile%252fmain%252fcsgl_case-front%252fcase-detail%253fid%xxx%2526isQuestionnaire%253d1&response_type=code&scope=snsapi_base&state=mpauth&connect_redirect=1#wechat_redirect
SKFrmwRespCookie: 6xgAIA8QASgVMAE4BUACWCLe
X-WX-FJ: 001,018,0000001024
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Connection: keep-alive
Host: open.weixin.qq.com
Referer: https://oa.m.xx.com/
Sec-Fetch-Dest: iframe
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: cross-site
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1 wechatdevtools/1.05.2012182 MicroMessenger/7.0.4 Language/zh_CN webview/16203834737588116 webdebugger port/40158 token/b05de146158c161335c7cb6c2828041c
appid: appid
redirect_uri: https://oa.m.xx.com/an:ntsapps/__login/?p=https%3a%2f%2foa.m.xx.com%2fan%3antsapps%2fcase_mobile%2fmain%2fcsgl_case-front%2fcase-detail%3fid%3dcf21341b28da415693319c038cf1999f%26isQuestionnaire%3d1
response_type: code
scope: snsapi_base
state: mpauth

第二次

Request URL: https://open.weixin.qq.com/connect/oauth2/authorize?appid=appid&redirect_uri=https%3a%2f%2foa.m.xx.com%2fan%3antsapps%2f__login%2f%3fp%3dhttps%253a%252f%252foa.m.xx.com%252fan%253antsapps%252fcase_mobile%252fmain%252fcsgl_case-front%252fcase-detail%253fid%xxx%2526isQuestionnaire%253d1&response_type=code&scope=snsapi_base&state=mpauth&connect_redirect=1
Request Method: GET
Status Code: 200 OK
Remote Address: 101.89.15.204:443
Referrer Policy: strict-origin-when-cross-origin
Cache-Control: no-cache, must-revalidate
Connection: keep-alive
Content-Encoding: gzip
Content-Length: 540
Content-Type: text/html; charset=gbk
SKFrmwRespCookie: 6xgAIAwQASgUMAE4A0ACWCLe
X-WX-FJ: 001,018,0000001024
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Connection: keep-alive
Host: open.weixin.qq.com
Referer: https://oa.m.xx.com/
Sec-Fetch-Dest: iframe
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: cross-site
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1 wechatdevtools/1.05.2012182 MicroMessenger/7.0.4 Language/zh_CN webview/16203834737588116 webdebugger port/40158 token/b05de146158c161335c7cb6c2828041c
appid: appid
redirect_uri: https://oa.m.xx.com/an:ntsapps/__login/?p=https%3a%2f%2foa.m.xx.com%2fan%3antsapps%2fcase_mobile%2fmain%2fcsgl_case-front%2fcase-detail%3fid%3dcf21341b28da415693319c038cf1999f%26isQuestionnaire%3d1
response_type: code
scope: snsapi_base
state: mpauth
connect_redirect: 1

在第二次跳转后,http status 是200,并没有返回第三方页面。

求助~~~~

回到顶部