使用 Microsoft.Identity.Web 时如何设置 AzureAD 重定向 url

How do you set the AzureAD redirect url when using Microsoft.Identity.Web

我有一些应用程序设置,它使用的是 blue/green 部署策略。当 运行 在本地时,一切正常,但是一旦部署,登录就会进入重定向循环,直到浏览器抛出 400.15 错误。问题似乎是由于反向代理,其中请求与应用程序 url 一起发送,但重定向 url 指向本地主机。下面是我被定向到的示例 url,您会注意到 redirect_uri 指向 localhost 而不是 example.com

https://example.com/b4e19cf5-ed91-44d3-81ce-70c848fa6841/oauth2/v2.0/authorize?client_id=CLIENT_ID&redirect_uri=http%3A%2F%2Flocalhost%3A8081%2Fsignin-oidc&response_type=id_token&scope=openid%20profile&response_mode=form_post&nonce=REALLY_LONG_STRING&x-client-SKU=ID_NETSTANDARD2_0&x-client-ver=5.5.0.0

我找到了一些答案 here 但这是 Microsoft.Identity.Web nuget 包存在之前的解决方案。现在建议在启动 class 中使用 .AddSignIn() 扩展,我不确定如何添加 git 问题中引用的 属性。

我认为这应该由 https://github.com/AzureAD/microsoft-identity-web#115 解决(即将在 Microsoft.identity.Web 中实施)

我还提供了解决此 GitHub 问题的方法:https://github.com/AzureAD/microsoft-identity-web/issues/115#issuecomment-620527830