4

我在 IdentityServer 中设置了以下客户端:

new Client
{
    ClientName = "My web application",
    Enabled = true,
    ClientId = "mywebapp",
    ClientSecrets = new List<ClientSecret>
    {
        new ClientSecret("somesecret")
    },

    Flow = Flows.Hybrid,

    ClientUri = "https://app.mydomain.com",

    RedirectUris = new List<string>
    {
        "oob://localhost/wpfclient",
        "http://localhost:2672/",
        "https://app.mydomain.com"
    }
}

它是在线托管的,比方说https://auth.mydomain.com/core

尝试修改MVC OWIN Client (Hybrid)示例客户端以登录到上述身份服务器,在Startup.cs我修改了ClientId,ClientSecretRedirectUri匹配 IdSrv 中的客户端设置。现在,当我尝试导航到需要授权的页面时,我被重定向到 IdentityServer 的 URL。当我登录时,断点AuthorizationCodeReceived在客户端的通知处命中,Startup.cs然后进入循环。浏览器状态显示:

Waiting for localhost...
Waitnig for auth.mydomain.com...
Waiting for localhost...
Waitnig for auth.mydomain.com...
...

依此类推,永远不会完成登录。为什么会这样?请帮忙。

谢谢!

4

1 回答 1

10

这很可能是由于在重定向中混合了 http 和 https 造成的。请始终使用一种方案并检查浏览器地址栏上的方案。

于 2015-04-22T08:59:57.737 回答