问题
I'm using Keycloak's JavaScript Adapter to connect a web application with the SSO of my workplace. The code looks like this (server data is loaded via they keycloak.json file):
const keycloak = Keycloak();
keycloak.init({onLoad: "login-required"}).success(authenticated => {
...
}).error(() => {
...
});
It works as intended on Firefox and Chrome, but on Internet Explorer (v. 11) the POST request for the token returns a 400 Bad Request. Is this a problem with my configuration of Internet Explorer or of Keycloak-js itself? Here is a screenshot from IE.
回答1:
The solution is fairly simple: The client that Keycloak-js wants to access has to be public
so that the client ID can be read and sent to the server. The absence of the property or its data missing from the cookies (Firefox and Chrome apparently solve this themselves) leads to the 400 Bad Request sent from the Keycloak server.
来源:https://stackoverflow.com/questions/52109944/keycloak-javascript-adapter-receives-400-bad-request-in-internet-explorer