Keycloak JavaScript适配器在Internet Explorer中收到400错误请求 [英] Keycloak JavaScript Adapter receives 400 Bad Request in Internet Explorer

查看:482
本文介绍了Keycloak JavaScript适配器在Internet Explorer中收到400错误请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Keycloak的JavaScript适配器将Web应用程序与工作场所的SSO连接起来.代码看起来像这样(服务器数据通过它们的keycloak.json文件加载):

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(() => {
    ...
});

它可以在Firefox和Chrome上正常运行,但是在Internet Explorer(v.11)上,令牌的POST请求返回一个400 Bad Request.我的Internet Explorer或Keycloak-js本身的配置是否有问题?这是IE的屏幕截图.

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.

推荐答案

解决方案非常简单:Keycloak-js要访问的客户端必须为public,以便可以读取客户端ID并将其发送给服务器. Cookie缺少属性或数据缺失(Firefox和Chrome显然可以自行解决),导致Keycloak服务器发送了400错误请求.

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.

这篇关于Keycloak JavaScript适配器在Internet Explorer中收到400错误请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆