Search code examples
javaazure-active-directoryazure-ad-msal

AADSTS500112: The reply address 'http://testurl' does not match the reply address 'https://testurl' when requesting Authorization code


i'm trying to integrate java application with azure ad .

i have registered an app in azure and added redirect url's , after successful login , it was redirected to my java application where i am fetching authorization code using msal library.

Getting the below exception

com.microsoft.aad.msal4j.MsalServiceException: AADSTS500112: The reply address

'http://testUrl' does not match the reply address 'https://testUrl

the only difference i see in the above url's is http and https, even though i mentioned https in both redirect url in the app registrations as well as redirect_uri in the microsoft login url.

btw, it was working with my local environment, not working when i hosted it on the server .


Solution

  • According to my research, the redirect URL for web apps and services must begin with the scheme https. If you want to use the scheme http, you just can use http:\\localhost. For more details, please refer to https://learn.microsoft.com/en-us/azure/active-directory/develop/azure-ad-endpoint-comparison#restrictions-on-redirect-urls