Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting redirect_uri on AspNetCore OpenIdConnect

On a .Net When i create a Open ID connect Authentication Options I have a property to set the RedirectUri this is even defined as recommended on the documentation but no such property exists on the AspNetCore it is automatically set to the current server EX:(http://localhost), is there a way to change this?

Trying to find a solution for this I came across of lots of shortcomings of the new AspNetCore Authentication is this production ready or just WIP?

like image 410
Pedro.The.Kid Avatar asked Mar 07 '23 06:03

Pedro.The.Kid


1 Answers

After fiddling around with this I found out that you have to set an event listener for the OnRedirectToIdentityProvider event.

services.AddOpenIdConnect(options =>
{
    Configuration.Bind("<Json Config Filter>", options);
    options.Events.OnRedirectToIdentityProvider = async context =>
    {
        context.ProtocolMessage.RedirectUri = "<Return URI String>";
        await Task.FromResult(0);
    };
});
like image 151
Pedro.The.Kid Avatar answered Mar 14 '23 21:03

Pedro.The.Kid