This article is a mirror article of machine translation, please click here to jump to the original article.

View: 3235|Reply: 2

[JavaScript] Failed to execute 'atob' on 'Window': The string to be decoded is not...

[Copy link]
Posted on 5/17/2024 1:18:33 PM | | | |
When the front-end uses js to obtain the Payload content in the jwt, an error occurs as follows:


Uncaught DOMException: Failed to execute 'atob' on 'Window': The string to be decoded is not correctly encoded.
The reason for the anomaly is because:Encoded strings with "-" or "_"(Base64 encoding contains two special characters "+" and "/", which are ASCII codes 43 and 47 in the character set, respectively.) These two characters are where Base64 encoding tends to cause problems, as some software systems do not recognize them. In practical use,You may need to replace these two special characters with other characters), the correct base64 string reference is as follows:

Base64 encoded string composition (what characters are in Base64)
https://www.itsvse.com/thread-10629-1-1.html
solution



This method also solves the problem of garbled characters in Chinese.




Previous:ASP.NET Core (twenty-nine) is deployed in a subdirectory (virtual directory) of the site
Next:Tertiary Schema and Secondary Image (Mapping) in the Database
 Landlord| Posted on 5/17/2024 2:03:16 PM |
Since escape is deprecated, a better way to implement it is as follows:




 Landlord| Posted on 8/12/2024 10:00:50 AM |
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com