Brief introduction of wechat applets service providers – third-party platform application, testing and the whole network release related processes. It also highlights examples of what the front and back ends need to do after becoming a third-party platform.

I. Initial experience of third-party platform development

Open the WeChat open platform https://open.weixin.qq.com/cgi-bin/frame?t=home/wx_plugin_tmpl&lang=zh_CN. Open the https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419 development of documents after developers qualification certification 318292 & token = & lang = zh_CN.

Select the third-party platform permission set

Note: It is recommended not to check the message management permission set unless required by the service. If checked, wechat will test this basic logic when applying for the qualification of whole-network publishing.

Net release and why testing is necessary

As the name implies, once a small program is published, all the small programs under the template are published. NO! Full web publishing is just a qualification. After the audit, the third-party platform can host the authorized public account/small program, login authorization. The back-end of the third-party platform can automate the management of small programs by adjusting API (core interface: setting domain name, setting classification, uploading code, binding experiential, obtaining experience TWO-DIMENSIONAL code, submitting audit and publishing).

  1. The process is as follows:
  2. Login authorization initiating page domain name: public account/small program development initiating authorization operations must be under this domain name. List of authorized test public numbers: the original ID (not appID) of the test public number/applet. Authorized Event Receiving URL: The fully qualified name of this interface for receiving official messages pushed by wechat. For example, a user cancels authorization or a component ticket. It will be pushed six times within an hour, and the application must return a SUCCESS response. Whitelisted IP address list: IP addresses that are not in this list cannot call related interfaces of wechat.

Here to explain: there are also bugs in wechat, will say what there is no test resources. In fact, this graph has been tested. Ocd can click again. Then it’s back and forth.

Two. Slowly clear

How do I register applets?

  1. Independent registration: The administrator of the authorized party can register a small program on the wechat public platform by himself (300 authentication fee is required for authentication), and provide appID and categories to a third party after completing the classification. And then through the authorization process technology at https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1453779503 &token=&lang=zh_CN Authorized to a third party.
  2. The third party quickly registers through THE API interface (youzan, Weimeng and other small program service providers are examples) : open.weixin.qq.com/cgi-bin/sho…

Why do I need authorization?

If you do not authorize, the third party is unable to develop for you. Because the generation of small programs to achieve business must be through the interface to achieve, since wechat has opened [third-party platform development] this mechanism, in fact, is hoping to be managed by the small program all previously seen in the ordinary small program back platform functions are open to the third party through the interface. Because the third party has the ability to develop and escrow. After authorization is granted, the third party background can obtain the authorizer_Accesstoken interface call token of the authorized apule. After a small program is quickly created through the API interface, wechat will push the registration audit event to the third party background if the registration is successful, which will contain the appID and auth_code(the authorization code can be exchanged for authorizer_Accesstoken) and other key information. The main interfaces of wechat to realize business opening for third-party applets are as follows:

After applet authorization is complete, log in to Applet Background – Settings – Third-party Authorization Management to unbind the authorized applet. The diagram below:

Three. Front-end small program changes

  1. Small program here introduces a template (small program template development: developers.weixin.qq.com/miniprogram… In the development test phase, the front end or with the development of ordinary small program development.

However, some parameters need to be identified by the front end and brought to the back end during login authorization. This parameter is configured into the applet by the third party platform background when uploading code. API: open.weixin.qq.com/cgi-bin/sho… For security, it is recommended to encrypt this parameter. In order to facilitate third-party platforms to use the same applet template to provide services for different applets, the third party can put the customized information in ext_JSON. In the template applet, the interface can be used to obtain the customized information, so as to distinguish different applets.

  1. After the front-end upload code is uploaded to the open platform, there is only one draft for each developer. It will automatically overwrite the last one, meaning that the draft box can only hold 10, and the appropriate version can be added to the template library. A maximum of 50 template libraries can be added. After the front-end upload is complete, third-party platforms can see it in the background of the applet and then specify the draft as a template. Then it’s ready for review and release.

Four. Getting on the good side

Token central console

Those who are familiar with wechat development services for urine know that wechat has an accessToken. Since the wechat side does not distinguish between test/formal environment, it only gives the caller 50 opportunities for accessToken per day, which cannot be accessed on the same day. However, the caller is separated from the environment, so it is better for the caller to prepare a central console specifically to obtain the token.

Third-party platforms do the same, but this time have two tokens: COMPONent_Accesstoken and Authorizer_Accesstoken. Component_accesstoken is a platform token, which needs to be replaced with the ticket pushed by wechat every 10 minutes every time it is updated. Although the official statement is valid for two hours, the author found in the test that the token needs to be refreshed when there is a change in ticket; otherwise, wechat will report an error message of expired token if the old token is used.

Authorizer_accesstoken is the authorizer applet token. After the applet is authorized, the third party will obtain the AuthCode, that is, the authorization code, and use the AuthCode (valid within 10 minutes and need to be re-authorized after expiration) to exchange refresh_Accesstoken. When the authorizer applets token expires, refresh_accesstoken is used to retrieve it.

Technical analysis of authorization process

This process is suitable for situations where the licensor has registered the applets themselves and then needs to license them to a third party. Applets registered directly through the Quick Create Applets interface do not need to do this.

Open.weixin.qq.com/cgi-bin/sho…

Fifth, third party background applet management

Anyway, I have basically implemented all the interfaces, and I don’t know which ones can be used at the beginning. According to the API documents given by wechat, most of them can be tuned. Third party platform to here, and not, please give me a message oh! Or post in the community…