我正在试用带有棱角2的钥匙斗篷。我正在做一个服务,就像他们在他们的医生里做的那样。但是,它总是返回not authenticated,即使当我连接到我的帐户keycloak (auth/realms/wb/account)时也是如此。
declare var Keycloak: any;
@Injectable()
export class UserMockService {
constructor() {
let keycloak: any = new Keycloak('assets/keycloak.json');
keycloak.init().success(function(authenticated) {
alert(authenticated ? 'authenticated' : 'not authenticated');
}).error(function() {
alert('failed to initialize');
});
}
}是的,它确实找到了json。
{
"realm": "wb",
"auth-server-url": "http://192.168.99.100/auth",
"ssl-required": "external",
"resource": "wb",
"public-client": true
}哦,是的,在我忘记之前:用来重定向用户连接到我的应用程序的URL到底是什么?看起来应该很容易找到,但是他们的医生太分散了。要连接到当前,我使用/auth/realms/wb/account,但这是连接到帐户设置的url。
所以流程是这样的:
http://192.168.99.100/auth/realms/wb/account。发布于 2016-11-05 12:21:04
我可以建议您查看一下键盘斗篷GitHub上的官方GitHub。
一个月前,我使用这个例子中的片段成功地创建了一个Keycloak安全的角2应用程序。
https://stackoverflow.com/questions/40418623
复制相似问题