身份验证后,Azure AD重定向到错误的位置(localhost) [英] Azure AD redirects to wrong location (localhost) after authentication

查看:48
本文介绍了身份验证后,Azure AD重定向到错误的位置(localhost)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有正在开发的代码,可以使用MSAL库(带有用于MSAL的Microsoft Angular包装器)在多租户设置中针对Azure AD授权.

I have code working in development that authorizes against Azure AD in a multi-tenant setup using the MSAL library (with the Microsoft Angular wrapper for MSAL).

当我针对 localhost:5001 运行该代码时,所有代码均按预期工作.

This code all works as expected when I am running it against localhost:5001.

我的配置包含用于 https://localhost:5001 redirectUri ,并且我在Azure AD中的应用程序将其重定向URI"值设置为相同.

My configuration contains a redirectUri for https://localhost:5001 and my application in Azure AD has its "Redirect URI" value set to the same.

但是,当我将其移至生产环境时,即使我更改了 redirectUri localhost:5001 >在我的配置中,以及Azure B2C应用程序重定向URI"现在都成为生产站点,位于:

However, when I move this to production, it is continuing to try to redirect me to localhost:5001 on a successful AD authentication, even though I have changed my redirectUri in my configuration, as well as the Azure B2C application "Redirect URI", to now be the production site at:

https://[mysite] .azurewebsites.net

它仍然从哪里获得 localhost:5001 ?我搜索了我的代码/配置,但该值不存在.该应用程序当前不在Azure AD中.我已停止并重新启动我的App Service,但无济于事.

Where is it still getting localhost:5001 from? I searched my code/configuration and this value does not exist. It is not currently in Azure AD for the Application. I have stopped and restarted my App Service to no avail.

它试图进行的重定向是:

The redirection it is trying to make is to:

https://localhost:5001/#id_token = eyJ0eXAiOiJKV1Qi ...

推荐答案

我能够通过删除Azure AD应用程序注册并使用适当的终结点从头开始创建新的注册来解决此问题.

I was able to work around this issue by deleting the Azure AD App Registration and creating a new one from scratch with the proper endpoints.

由于某些原因,在编辑和保存端点URL时并没有保留"更改.它在Azure AD控制面板中为应用程序注册显示了正确的终结点,但是仍在重定向到 localhost .

For some reason, it was not "holding" the change when the endpoint URLs were edited and saved. It showed the correct endpoints in the Azure AD control panel for the App Registration, but it was still redirecting to localhost.

删除并重新创建后,它会将答复正确转发到生产站点.

When I deleted and re-created, it properly forwarded the replies to the production site.

我目前不确定这是否是微软方面的问题,但这最终解决了该问题.

I am unsure at this time if this is an issue on Microsoft's side or not, but this conclusively resolved the issue.

这篇关于身份验证后,Azure AD重定向到错误的位置(localhost)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆