Umbraco 8.0 登录问题

Umbraco 8.0 Login Issues

我在 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 安全的一部分:

"Protection from JSON Hijacking is provided if the server prefixes all JSON requests with following string ")]}',\n". AngularJS will automatically strip the prefix before processing it as JSON. For more information please visit JSON Hijacking Protection."

https://docs.angularjs.org/guide/security#json-hijacking-protection

也可以在Umbraco源码中看到实现: