How to solve the garbled problem of Applet wx. login decryption, Applet wx. login
How to solve the garbled problem of the applet wx. login decryption
We have recently developed small programs for our company and need to use logon. According to the document requirements, we need to decrypt the obtained user information according to AES.
I used the official PHP demo and copied it to the program. The test showed that there was a garbled code in front of the decrypted data.
Similar to this, the previous section is garbled.
After careful inspection, it is found that the account and confidential information in the official demo can be decrypted, which indicates that the decryption code is correct.
Later, I searched the developer community and found a lot of decryption failures. One of the answers is the problem caused by multiple calls to wx. login.
Finally, I saw the solution, so I hurried to view my code. However, it was found that only one call was performed for half a day, which is not the problem at all.
Once, I got to a dead end and couldn't help it. Let's check the code.
According to the document, we should first call wx. login (), and then call wx. getUserInfo (), so I thought, will it be that I set wx. what if the value obtained by getUserInfo () is not correctly transmitted to the server?
If you are not sure, you have to check it out. Print the return value of wx. getUserInfo ().
After seeing the results, I checked the parameters of my request server. When I saw encryptData, I found the problem. What I wrote in this document is that the value of encryptedData should be used for decryption, while I set the value of encryptData
The decryption result is incorrect.
So far, if a problem is found, the decryption is successful after the parameter is changed to encryptedData.
To sum up the problem, the parameter name of encryptData and encryptedData In the wx. getUserInfo () return value is too similar, so I cannot use the wrong variable.
I don't know why I need to return another useless parameter (which has not been found yet), and this is not mentioned in the document.
I hope that you will be careful when coding and do not make such mistakes.
Thank you for reading this article. I hope it will help you. Thank you for your support for this site!