Today, accidentally put the micro-letter Jssdk Debug opened, found that debugging information always prompts the signature error, the feelings of the two days before the API "occasional" does not take effect, not because the code has not been executed, but because the signature is not correct AH! , this is a 100% error that can be reproduced.
But as long as the Spa has just been refreshed, or after loading the midway without a jump, the signature will be correct.
And when the route changes, we have a new "jump" page to re-sign, but there is a signature error, and our signature is clearly correct, take a variety of parameters to the micro-mail JS Signature Verification tool (http://mp.weixin.qq.com/debug/cgi-bin/ Sandbox?t=jsapisign) to go is the same!
The major discovery of the following ... In fact
Just sign it as soon as you load the SPA entry page, because the URL for the micro-mail signature is like the URL of the first loaded page in the spa ... Window.location.href jump is actually quite loaded again a spa
Once thought that the route jumps, should take the new URL to re-sign, but precisely because of this, the signature check to make a mistake.
So the solution is:
Only signed the first loaded page on the line, with Ui-router jump, it seems just changed the address. And this address is modified. The signature of a micro-letter does not seem to be recognized. He recognized the URL of the first loaded page.
Through this article, I hope to help to meet the problem of friends, thank you for the support of this site!