【问题标题】:Identity Server 4 redirecting to development URL not productionIdentity Server 4 重定向到开发 URL 而不是生产
【发布时间】:2020-10-28 08:32:57
【问题描述】:

我在使用 IDS4 时遇到了一个奇怪的情况。

我有一个 Blazor WA 应用、API 和 IDS4。 Blazor 和 API 与 IDS4 挂钩,大部分情况下一切正常。您在 Blazor 中单击登录,它会将您发送到您进行身份验证的 IDS4,然后将您发送回 Blazor,然后您可以访问 API。都很好。

注册时除外。 Blazor 获取您的信息并生成注册电子邮件。用户点击调用 API 中验证令牌等方法的链接,然后将您发送到 IDS4 登录。当用户在这里登录时,它不会将您发送到生产 Blazor URL,而是将其发送到开发 URL,我不知道它是如何知道开发 URL 是什么的。这发生在任何机器上,而不仅仅是我的开发工作站。这是 appsettings.json。

"ConnectionStrings": {
    "DefaultConnection": "Server=xxxxx;Database=xxxxxx;User Id=xxxxx;Password=xxxxxx"
},
"ClientURLs": {
"BlazorWA": "https://prodURL.azurewebsites.net/"
},
"IdentityServer": {
"Clients": [
  {
    "AllowOfflineAccess": true,
    "AllowedCorsOrigins": "*",
    "Enabled": true,
    "RequireConsent": false,
    "RequireClientSecret": false,
    "RequirePkce": true,
    "ClientId": "blazorWA",
    "ClientName": "blazorWA",
    "ClientUri": "https://prodURL.azurewebsites.net/",
    "RedirectUris": [ "https://prodURL.azurewebsites.net/authentication/login-callback" ],
    "AllowedGrantTypes": [ "authorization_code" ],
    "AllowedScopes": [ "openid", "profile", "email", "appAPI" ],
    "PostLogoutRedirectUris": [ "https://prodURL.azurewebsites.net/" ]
  }
  ]
}

不知何故,只有从注册路径,当用户单击登录时,它会尝试转到“https://devURL....”

我唯一能想到的就是以某种方式读取 appsettings.Development.json?这有可能出版吗?但为什么有时它会起作用?

谢谢。

【问题讨论】:

  • 这部署到 Azure btw。

标签: identityserver4 appsettings azure-appservice


【解决方案1】:

不确定实际问题是什么,但感觉 Azure 中有一个带有开发设置的文件,我转到我的发布设置并在“文件发布选项”下检查了“在目标位置删除其他文件”,这会清除当前要发布的文件集中没有的任何内容,现在它会重定向到正确的 URL。

¯_(ツ)_/¯

【讨论】:

    猜你喜欢
    • 2017-10-18
    • 1970-01-01
    • 2014-07-25
    • 2011-04-29
    • 2022-01-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-02
    相关资源
    最近更新 更多