shaddow
shaddow

Reputation: 107

How to change redirect_uri for Azure AD

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 enter image description here

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.

Upvotes: 1

Views: 20657

Answers (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: enter image description here

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.

Upvotes: 1

Related Questions