Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Incorrect reply URL with OpenId Connect when connecting to Azure AD

$
0
0

In Azure AD, I set up a Reply URL that is different from the Sign-on URL, hoping that the code would return to a different location after user signs in. But I was not able to get it working: the code always returns  to the login URL. I am wondering if someone could point out what I did wrong:

I set up OpenId authentication using the following code:

app.UseOpenIdConnectAuthentication(options =>
{

   options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
   options.ClientId = "xxx";
   options.Authority = "xxx";

}

I also registered a middleware like the following:

app.UseMiddleware<AuthenticateMiddleware>();

//In AuthenticateMiddleware.cs

var properties = new AuthenticationProperties { RedirectUri = "http://localhost:3000/#/about" };
await context.Authentication.ChallengeAsync(OpenIdConnectDefaults.AuthenticationScheme, properties);

In Azure Directory,  my Sign-on URL is http://localhost:3000,and the Reply URL is http://localhost:3000/#/about. When examining the generated OpenID URL, I noticed that redirect_url is the sign-on URL, not the Reply URL as was specified in the middleware.

Any thoughts on how to fix this issue? I played with GitHub's original Azure-angularJS examplehere, and was able to replicate the behavior where Reply URL is NOT respected. Thanks for your help in advance!


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>