I would like to implement a web application for a company in China. I need to use WeChat mini-APP
to make the sign-up/login straight-forward.
Please correct my assumptions if I am wrong:
WeChat
, I need to use the OAuth2
protocolWeChat developer account
under a real name (need ID card or business registration stuff) if I want to diffuse the applicationdomain name
to WeChat
so that they can allow OAuth2 authentication
to this domain nameQuestion: can I still use my localhost virtual machine
to develop my server?
(I didn't try but I assume WeChat will reject to create an OAuth2 token
for localhost 127.0.0.1
)
Or do I need to have a development domain name with a development server available from the Internet so that I can debug the OAuth2 authentication?
EDIT 1: I tried to send a HTTPS POST request https://127.0.0.1:8080
and I got an error linking to this URL
https://developers.weixin.qq.com/miniprogram/dev/framework/ability/network.html
EDIT 2: I tried to send a HTTPS POST request https://192.168.1.148:8080
which correspond to my dev computer and I got the error VM17415:1 Cannot send network request to localhost.
(My test phone and computer both connected to network 192.168.1.x trough WiFi)
The documentation is available in English on the official WebSite [1]. It is written: network APIs allow communication with LAN IP addresses
. So basically, if the phone is connected to the same network as the virtual machine (i.e. WiFi), one should be able to send any kind of HTTP/HTTPS request properly.
Note that the development environment WeChat DevTools block this feature by default. In order to enable it, the user should open the Project Settings
and check the box
'Does not verify valid domain names, web-view (business domain names), TLS versions and HTTPS certificates.'.
[1] https://developers.weixin.qq.com/miniprogram/en/dev/framework/ability/network.html