【发布时间】:2021-01-22 03:30:25
【问题描述】:
我正在使用 angular-auth-oidc-client lib 以 keycloak 作为身份服务器来验证我的应用程序。我能够登录到应用程序,但是注销功能不起作用。我已阅读文档并使用相同的注销调用,但它似乎不起作用。请帮忙。提前致谢。
这是我的配置:
{
"sts_server": "http://localhost/auth/realms/test",
"redirect_url": "http://localhost:4200/app/",
"client_id": "test_client",
"response_type": "code",
"scope": "openid profile email",
"post_logout_redirect_uri": "http://localhost:4200/app/#/homepage/",
"startup_route": "/homepage/welcome",
"start_checksession": "true",
"silent_renew": "true",
"silent_renew_url": "assets",
"max_id_token_iat_offset_allowed_in_seconds": "10",
"logLevel": "info",
"forbidden_route": "/unauthorized",
"unauthorized_route": "/unauthorized"
}
我的注销方法:
logOut() {
this.oidcSecurityService.logoffLocal();
this.oidcSecurityService.logoffAndRevokeTokens();
this.oidcSecurityService.logoff();
// none of the three mentioned above work.
}
【问题讨论】:
-
您好@wazza,您找到解决方案了吗?如果是,请回答,我会投票,以便帖子可以尽快关闭。如果否,请提供更多详细信息。注销时会发生什么?您在控制台中遇到错误吗?控制台输出是什么,您是否看到相关的网络请求?顺便说一句 .logoff() 对于大多数情况来说应该足够了。
-
@GeofoxCoding 我还没有找到解决方案。我还在寻找。控制台上看不到任何错误。
-
好的,首先添加一个调试日志级别,例如“logLevel:LogLevel.Debug”。然后只执行 .logoff() 并在您注销时查看您的网络流量。您应该看到一个对端点 /logout 的请求,其中包含 id_token_hint 和 post_logout_redirect_uri。重定向回您的应用程序。还要查看此请求的响应位置标头。
标签: angular keycloak openid-connect angular-auth-oidc-client