Note: After logging in, you can view the corresponding interface permissions in the Developer Center.
2. Page introduction js:/open/js/jweixin-1.0.0.js.
3. All pages that need to use JS-SDK must be filled with configuration information first.
wx.config({
Debug: true,//Turn on debugging mode, and the return values of all called APIs will be displayed in the client alarm. If you want to view the incoming parameters, you can open them on the pc side, and the parameter information will be printed through the log, which will only be printed on the pc side.
AppId:'',//required, the unique identification of the official account of WeChat.
Timestamp:,//Required, generates the timestamp of the signature.
NonceStr:'',//Required, generates a signed random string.
Signature:'',//required, signature, see appendix 1.
JsApiList: [] // Required, list of JS interfaces to use. For a list of all JS interfaces, see Appendix 2.
});
4. Signature algorithm
Before generating a signature, you must understand jsapi_ticket, which is a temporary ticket used by WeChat official account to call WeChat JS interface. Generally, the validity period of jsapi_ticket is 7200 seconds, which is obtained through access_token. Because the number of api calls to get jsapi_ticket is very limited, frequently refreshing jsapi_ticket will limit api calls and affect its own business. Developers must globally cache jsapi_ticket in their own services.