【发布时间】:2019-07-14 04:15:51
【问题描述】:
我们有与身份服务器 4 通信的 Angular 门户,它与我们自己的域很好地配合。我们想添加对自定义域的支持,为此我们将域名存储在我们的数据库中,每当打开任何角度门户链接时,我们都会从数据库中获取域名并分配给 authConfig,如下所示:
Object.assign(authConfig, { issuer: domainNam });
this.oauthService.configure(authConfig);
this.oauthService.tokenValidationHandler = new JwksValidationHandler();
this.oauthService.loadDiscoveryDocumentAndTryLogin().then(() => {
// .... rest of the code
});
它为发行者设置了当前的域名,但它不会重定向到登录页面,而是向我显示以下错误:
链接是这样的:
这里出了什么问题?
如果没有设置发行者,那么它工作正常,但是当我动态设置发行者时,它会产生这个问题。
authConfig如下:
export const authConfig: AuthConfig = {
// Url of the Identity Provider
issuer: environment.identityServer.authority,
// URL of the SPA to redirect the user to after login
redirectUri: window.location.origin + "/auth-callback",
// The SPA's id. The SPA is registerd with this id at the auth-server
clientId: environment.identityServer.client_id,
// set the scope for the permissions the client should request
// The first three are defined by OIDC. The 4th is a usecase-specific one
scope: environment.identityServer.scope,
logoutUrl: environment.identityServer.authority + '/Account/Logout',
}
【问题讨论】:
-
或许here的答案对你有帮助。
-
嗨,谢谢,但这不是我要找的东西:|
-
您从身份服务器 4 得到什么错误(如果有)?
-
@cheesemacfly - 错误提示:抱歉,出现错误:未授权客户端
-
@Neel 您需要弄清楚为什么会出现此错误,它应该有助于解决您的问题。
标签: angular asp.net-web-api oauth identityserver4