我有一个带有.NET Core WebApi和IdentityServer的Angular5 APP。
构建和部署后,我看到了 Unauthorized_Client “无效的重定向Uri”。
我目前仍在解决此问题。
这些是采取的步骤:
此重定向Uri设置为:http://localhost:4200/signin-oidc
我确定与RedirectUri相关的所有值都匹配
数据库中的(1) IdentityServerData。 ClientRedirectUri,列RedirectUri
安全项目中的(2)> IdentityServer.webapi 公共静态类ConfigurationDbContextSeederExtensions { #region公共静态方法
/// <summary>
/// Seeds the identity server data tables to make sure they always have data.
/// </summary>
/// <param name="context"></param>
public static void EnsureSeedDataForContext(this ConfigurationDbContext context)
{
new Client
{
ClientId = "myapp-client",
ClientName = "My App",
AccessTokenType = AccessTokenType.Reference,
AllowedGrantTypes = GrantTypes.Implicit,
AllowAccessTokensViaBrowser = true,
RequireConsent = false,
AllowedScopes =
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
IdentityServerConstants.StandardScopes.Email,
"myapp-api"
},
RedirectUris = new List<string> {"http://localhost:4200/signin-oidc"},
PostLogoutRedirectUris = new List<string> { "http://localhost:4200" }
}
};
(3)和环境中。prod.ts
openIdConnectSettings: {
authority: 'http://localhost:61173/',
client_id: 'myapp-ng',
redirect_uri: 'http://localhost:4200/signin-oidc',
scope: 'openid email profile myapp-api',
response_type: 'id_token token',
post_logout_redirect_uri: 'http://localhost:4200',
automaticSilentRenew: true,
silent_redirect_uri: 'http://localhost:4200/redirect-silentrenew'
}