How to change redirect_uri for Azure AD

偶尔善良 提交于 2021-01-29 10:43:11

问题


I've got Azure ServiceFabric web-app (AspNetCore 3) hosted over reverse proxy (NGinx). The app use AzureAD (in company) authentication. I've Registered App for the AD and setup Redirect Urls. After publishing the APP and configuring DNS and reverse proxy I tried to authorize to my app but failed with error

AADSTS50011: The reply URL specified in the request does not match the reply URLs configured for the application: '...-...-...-...-...'.

I snifed the request and found that it redirects to the internal IP but not domain name

https://login.microsoftonline.com/aeb55839-c47b-4fea-8d95-912f673fa7ac/oauth2/v2.0/authorize?client_id=.....&redirect_uri=http%3A%2F%2F10.2.0.5%3A44321%2Fsignin-oidc...

It seems that I've looked everywhere but I cannot stil found where I can specify redirect url manually (only CallbackPath). Does anyone solve the issue?

Update 1.

Add screenshot from Azure Portal

Update 2

Mannually add http://10.2.0.5:44321/signin-oidc to the Redirect Url, get a new exception AADSTS500117: The reply uri specified in the request isn't using a secure scheme. I wonder whether I have to make my ASF cluster secured to allow AD Authorization? It seems to me strange due to I want to secure traffic to reverse proxy only.


回答1:


This error will occur when there is a mismatch of redirect URI being sent in the request to AAD while fetching the token and the one registered with the Application Registration Object in AAD portal.

In App Registration blade of AAD and look for the redirect URI section present under "Authentication" section of the registered application and update the redirection URL. Please refer to the screenshot below:

update:- The Reply url you are using in your code is http://10.2.0.5:44321/signin-oidc which is different from reply url defined in Azure AD i.e., https://dev-adm.project-llc.ru/signin-oidc. Please update the reply url in code or in AAD.



来源:https://stackoverflow.com/questions/64169170/how-to-change-redirect-uri-for-azure-ad

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