WeChat applet wx. login decryption garbled problem solution, Applet wx. login

Source: Internet
Author: User

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!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.