因此,我已经用reactjs实现了keycloak,并且它在chrome中可以正常工作,但是当我尝试在IE或safari中运行它时,它甚至都没有登录。即,我收到无效用户错误。与Safari和IE中相同。
以下是我初始化密钥斗篷的反应代码。
import Keycloak from "keycloak-js";
const kc = new Keycloak({
realm: "claro",
url: "URL",
"ssl-required": "none",
resource: "apps",
"public-client": true,
"verify-token-audience": true,
"use-resource-role-mappings": true,
"confidential-port": 0,
clientId: "apps"
// "clientSecret":"",
// "enable-cors": true
});
let app = (
<HashRouter basename={"/"}>
<div>
<Route
exact
path="/"
render={props => {
return <UI {...props} kc={kc} />;
}}
/>
<Route
exact
path="/rms"
render={props => {
return <Rms {...props} kc={kc} />;
}}
/>
<Route
exact
path="/iaasmobile"
render={props => {
return <Iaasmobile {...props} kc={kc} />;
}}
/>
</div>
</HashRouter>
);
kc.init({ onLoad: "login-required",checkLoginIframe: false })
.success(authenticated => {
// console.log(authenticated, kc);
if (authenticated) {
ReactDOM.render(app, document.getElementById("root"));
}
})
.error(e => {
Swal({
type: "error",
title: "Error Authentication"
});
});
PS
仅供参考,当我将URL替换为URN的IP地址时,它可以工作。
即url:"//sso.asd.com/auth"
至url:"//13.23.45.67/auth"