Azure AD redirects to wrong location (localhost) after authentication

≡放荡痞女 提交于 2021-01-05 08:46:49

问题


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).

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

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

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

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 ...


回答1:


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.

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.




回答2:


Registering a new application solved this issue.



来源:https://stackoverflow.com/questions/58757232/azure-ad-redirects-to-wrong-location-localhost-after-authentication

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!