Invalid signature error. It is recommended to check in the following order:
1 Confirm that the signature algorithm is correct. Can I use /debug/cgi-bin/sandbox? Jsapisign page tool for verification.
2. Confirm that the nonce string (hump standard capital S in JS) in the configuration and timestamp is consistent with the corresponding nonce str and timestamp in the signature.
3 Confirm that the URL is the complete URL of the page (please confirm it on the current page alert (location.href.split ('#') [0]), including' http(s)://' and'?' . Gets the following parameter part, but does not include the part after the "#" hash.
4 confirm that the appid in config is consistent with the appid used to obtain jsapi_ticket.
5 ensure that access_token and jsapi_ticket are cached.
Make sure that the url you get for signing is obtained dynamically. For dynamic pages, please refer to the implementation of php in the sample code. If the static page of html sends the url to the background for signature through ajax at the front end, the front end needs to use js to obtain the links of the current page except the' #' hash part (which can be obtained through location.href.split('#')[0], and requires encodeURIComponent), because once the page is shared, the WeChat client will add other parameters at the end of your link, and if the current link is not dynamically obtained, the shared page signature will be invalid.