This is the 13th day of my participation in the August More text Challenge. For details, see: August More Text Challenge

One, foreword

In the development of wechat public account, the configuration of wechat public account needs to be set

  • The business domain
  • JS Indicates the security domain name of the interface
  • Authorized Web 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.

Ii. Business domain name

After a service domain name is set, pages under this domain name will not be reformatted when accessed from wechat. No security prompt is displayed when the user enters the domain name. — from wechat official

To put it bluntly, the web page is configured without official authentication. If not configured, the following message may appear when a user visits your web page.

The user sees the prompt above, estimate also is in the mind a tight, I enter fraud webpage.

The key to solve this problem is to set the business domain name, the setting method is to scan the code to enter the public account background as an administrator, choose to enter the setting and development -> public account Settings -> function Settings, set the specific process of wechat official explanation is very clear, in accordance with the requirements to do.

Pay attention to

Fill in the domain name MP_verify_*. TXT must ensure normal access, otherwise everything is in vain, the specific location can be placed with reference to the following table.

The domain name File Location
The domain name The domain name/MP_verify_ *. TXT
Domain name/project name Domain name/project name /MP_verify_*.txt

JS interface security domain name

After setting the JS interface security domain name, the developers of the public account can call the JS interface opened by wechat in this domain name. — from wechat official

To put it bluntly, this is closely related to the use of JS SDK at the front end. If the JS interface security domain name is not configured or configured incorrectly, the front end cannot normally use the function, or even prompt the following error information.

config err: invalid signature
config err: invalid url domain
Copy the code

For example, the front end needs to provide sharing to the circle of friends function, login authorization, coupons and so on need to use THE JS SDK.

The key to solve this problem is to set JS interface security domain name, setting method for scanning code to enter the identity of the administrator to enter the public account background, choose to enter the setting and development -> public account Settings -> function Settings, set the specific process of wechat official explanation is very clear, in accordance with the requirements to do.

Pay attention to

  • The JS interface security domain name must be a level 1 or higher domain name, and must be registered through ICP. You can fill in five domain names.
  • Simply put, the server domain name of the front-end H5 project is the JS interface domain name, remember, must be the domain name, not IP.
  • There must be port 80, do not gild the lily to add what 8080 port, wechat official is not recognized.