IdentityServer4 客户端 redirectURI 问题

Jak*_*keJ 5 identityserver4

我在 IdentityServer4 主机端配置了以下客户端:

new Client
{
     ClientId = "myClient",
     ....
     RedirectUris = {"https://localhost:44001/home/claims", 
                      "https://localhost:44001/"}
     ....
}
Run Code Online (Sandbox Code Playgroud)

我目前正试图让它以这样一种方式返回,无论它来自客户端应用程序中的哪个控制器,它都能正常工作(因为在客户端应用程序启动时配置了 redirectURI 并且必须匹配服务器的客户端配置)。

在客户端应用启动时,相关代码:

app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions
{
     ...
     ClientId = "myClient",
     RedirectUri = "https://localhost:44001/",
     ...
}
Run Code Online (Sandbox Code Playgroud)

当我在客户端启动时将 redirectUri 设置为上面的第二个选项“ https://localhost:44001 ”时,我被重定向到客户端错误控制器,并出现以下错误:

“抱歉,出现错误:unknown_client Invalid redirect_uri”。

此外,服务器向控制台输出以下错误:

Exception thrown: 'System.FormatException' in System.Private.CoreLib.dll IdentityServer4.Validation.AuthorizeRequestValidator:Error: Invalid redirect_uri: https://localhost:44001/ { "ClientId": "myClient",
... "AllowedRedirectUris": [ "https://localhost:44001/home/claims", "https://localhost:44001/" ], "SubjectId": "anonymous", "RequestedScopes": "", "Raw": { "client_id": "myClient", "redirect_uri": "https://localhost:44001/", "response_mode": "form_post", "response_type": "code id_token", ... } }

It's almost like you cannot have multiple redirect URIs for a client, but that can't be right.