The WeChat third-party platform builds a PC authorization link, and directly opens the error report: the domain name of the authorization entry page: empty

微信第三方平台构建PC端授权链接,直接打开报错:错误 请确认授权入口页所在域名,与授权后回调页所在域名相同,并且,此两者都必须与申请第三方平台时填写的授权发起页域名相同。授权入口页所在域名:空。

1. WeChat third-party platform builds a PC authorization link, and directly opens the error: error Please confirm the domain name of the authorized entry page, which is the same as the domain name of the callback page after authorization, and both must be the same as the authorization page domain name filled in when applying for a third-party platform. The domain name of the authorization entry page is: empty. as shown in Figure 1

微信第三方平台构建PC端授权链接,直接打开报错:错误 请确认授权入口页所在域名,与授权后回调页所在域名相同,并且,此两者都必须与申请第三方平台时填写的授权发起页域名相同。授权入口页所在域名:空。
Figure 1

2. In the existing programs, open the authorization entry page first, and then jump to the authorization link on the PC terminal. No errors are reported, and the QR code to be scanned normally displays. Carefully compare the differences between the two, and the page of the QR code is displayed normally, and the request header includes: Referer. as shown in Figure 2

在现有已经实现的程序中,先打开授权入口页,再跳转至PC端授权链接,未报错,正常显示待扫描的二维码。仔细对比二者的差异,正常显示二维码的页面,其请求头中包含:referer。
Figure 2

3. Carefully compare the differences between the two, and the page of the QR code is displayed normally, and the request header includes: Referer. The error page does not contain: referr. as shown in Figure 3

仔细对比二者的差异,正常显示二维码的页面,其请求头中包含:referer。而报错的页面不包含:referer。
Figure 3

4. Official document: The third-party platform-based service provider builds an authorization link and puts it on its own website. After the user clicks, the authorization page will pop up. Decided to put the authorization link on the PC side under the authorization page domain name. Add a link at http://console.dev.chinamcloud.cn/ccpauth . as shown in Figure 4

官方文档:第三方平台型服务商构建授权链接放置自己的网站,用户点击后,弹出授权页面。决定将PC端授权链接放在授权发起页域名下。在 http://console.dev.chinamcloud.cn/ccpauth 添加链接。
Figure 4
<a href="https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=wxd 98c58b273d21bdf&pre_auth_code=preauthcode@@@v8lwmb5dqykvfjl8wuokpwyn9zmht -n8coz7b7xxhkqth3qpamjjpsbk5q6lwgxs7y49-h_zefijqdm8iecpvw&redirect_uri=ht tps://console.dev.chinamcloud.cn/ccpauth&auth_type=1">PC-side authorization link</a>

5. Right-click: the authorization link on the PC side, open the link in the new tab. If no error is reported, the QR code to be scanned normally displays, and its request header includes: Referer. as shown in Figure 5

右键:PC端授权链接,在新标签页中打开链接。未报错,正常显示待扫描的二维码,其请求头中包含:referer。
Figure 5

6. Check HTTP Headers on the MDN Web Docs -> Referer. The Referer request header contains the address of the source page of the current request page, which means that the current page is entered through the link in this source page. as shown in Figure 6

查看 MDN Web Docs 上的 HTTP Headers -> Referer。Referer 请求头包含了当前请求页面的来源页面的地址,即表示当前页面是通过此来源页面里的链接进入的。
Figure 6

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.