WeChat development | Configure the key domain name of the WeChat public account (1)


theme: channing-cyan

This is the 13th day of my participation in the August Update Challenge. For details of the event, check: August Update Challenge

I. Introduction

When developing a WeChat official account, configuring the WeChat official account requires setting

  • business domain name
  • JS interface security domain name
  • Web page authorized domain name

What's the problem if you don't configure these? How to configure it? What are the precautions in the configuration process? Please read on.

2. Business domain name

After setting the business domain name, when visiting the page under the domain name in WeChat, it will not be rearranged. When the user enters the domain name, no security prompt will appear. --From WeChat Official

To put it bluntly, the configured web page has not been officially certified. If no configuration is performed, the following prompt message may appear when the user visits your webpage.

p1.1.png

p1.2.png

When the user sees the prompt above, he probably feels nervous, whether I have entered a fraudulent webpage.

The key to solving this problem is to set the business domain name . The setting method is to scan the QR code to enter the background of the official account as an administrator, and choose to enter Settings and Development->Official Account Settings->Function Settings .

Notice

The filled domain name MP_verify_*.txtmust be able to be accessed normally, otherwise everything will be useless. Please refer to the table below for the specific location where it can be placed.

| Domain Name| File Storage Location| | ------ | ---------------------- | | Domain Name| Domain Name/MP verify .txt | | Domain Name/Project Name| Domain Name/Project Name/MP_verify_ .txt |

3. JS interface security domain name

After setting the secure domain name of the JS interface, the developer of the official account can call the JS interface opened by WeChat under the domain name. --From WeChat Official

To put it bluntly, this is JS SDKclosely related to the use of the front-end. If the JS interface security domain name is not configured or configured incorrectly, the front-end will not be able to use the functions normally, and will even prompt the following error message.

config err: invalid signature config err: invalid url domain

For example, the front-end needs to provide the function of sharing to Moments, login authorization, coupons, etc. all need to be used JS SDK.

The key to solving this problem is to set the JS interface security domain name . The setting method is to scan the code to enter the background of the official account as an administrator, and choose to enter Settings and Development->Official Account Settings->Function Settings . The official explanation of the specific process of setting is very clear, just follow the requirements.

Notice

  • The security domain name of the JS interface filled in must be a domain name of the first level or above, and must pass the ICP record, and five domain names can be filled in.
  • Simply put, the domain name of the server running the front-end h5 project is the domain name of the JS interface. Remember, it must be the domain name, not the IP.
  • In addition, the port must be port 80. Don’t add any extra port 8080. Wechat officials don’t approve it.

Guess you like

Origin blog.csdn.net/DynmicResource/article/details/120134826