am在Umbraco登录的PostLogin API响应中获取垃圾字符。这导致所有其他api显示401未经授权的错误。
即使isAuthenticated API返回的也为false。
Umbraco是托管版本,我们正在运行8.2.0。
这是标准安装。 LegacyEncoding设置为true。
这是我得到的答复。前导字符是垃圾字符。Image here
)]}', ---Junk Values
{"email":"xxxxxxxxxxxxxxxxxx","locale":"en-US","emailHash":"ac88ae0de8ce43ba72dac1cd208d4e87","userGroups":[],"remainingAuthSeconds":1200.0,"startContentIds":[],"startMediaIds":[],"avatars":[],"allowedSections":[],"id":-1,"name":"xxxxxxxxxxxx"}
不是垃圾,它是AngularJS JSON安全性的一部分:
“如果服务器为所有前缀,则提供来自JSON劫持的保护带有以下字符串“)]}',\ n”的JSON请求。 AngularJS将在将其处理为JSON之前自动删除前缀。欲了解更多有关信息,请访问JSON劫持保护。“
https://docs.angularjs.org/guide/security#json-hijacking-protection
您还可以在Umbraco源代码中查看实现: