When configuring the OpenIdConnectOptions.CallbackPathin asp.core, can we provide our own controller/action method to intercept the code being returned from the OIDC server?
I have set up a controller/action method to handle the returned code and in the Startup.cs class, added this option:
.AddOpenIdConnect("oidc", options =>
{
//other options
options.CallbackPath = new PathString("/oidc/codehandler");
}
But the action method never gets called even though I see a redirection happening after the user signs in:
http://myserver.com/oidc/codehandler?scope=openid&state=abc123&code=xyz456
What am I doing wrong here?
The CallbackPath is the path where server will redirect after authentication. It's automatically handled by the OIDC middleware itself, We don’t need to create this in our application, the middleware will handle this.
You can use notification events in OIDC OWIN Middlerware which invokes to enable developer control over the authentication process . For example , AuthorizationCodeReceived event can be used to acquire access token using authorization code .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With