使用IdenityServer4成功登录后重定向到localhost Web应用程序

时间:2018-08-09 12:23:20

标签: asp.net-core identityserver4

我刚刚申请了this quickstart example from IdentityServer4 documentation。我目前有3个应用程序:一个用于登录(我将其称为“登录页面”),一个是webapi端点,另一个是javascript SPA(单页面应用程序)。

如果其中一个webapi端点要求对用户进行身份验证,则它将通知SPA应用。然后,SPA应用程序将我重定向到我最近部署到Internet的登录页面。

现在,this configuration

            // JavaScript Client
            new Client
            {
                ClientId = "js",
                ClientName = "JavaScript Client",
                AllowedGrantTypes = GrantTypes.Implicit,
                AllowAccessTokensViaBrowser = true,

                RedirectUris =           {
                    "http://localhost:5003/auth-callback",
                    "http://localhost:5003/assets/silent-refresh.html"
                },
                PostLogoutRedirectUris = { "http://localhost:5003/" },
                AllowedCorsOrigins =     { "http://localhost:5003" },

                AllowedScopes =
                {
                    IdentityServerConstants.StandardScopes.OpenId,
                    IdentityServerConstants.StandardScopes.Profile,
                    "api1"
                }
            }
只要登录页面在localhost中运行,

即可正常工作。

现在,我将登录页面部署到了Internet。这意味着成功登录后,它将尝试将用户重定向到:

  

http://localhost:5003/auth-callback

在本地无法使用,无法通过Internet URL访问。

现在,请记住我需要在本地测试SPA应用程序:如何配置IdentityServer4,以便可以在本地测试我的应用程序,但要使用放置在Internet上的身份提供程序?

0 个答案:

没有答案
相关问题