'Openiddict don't respect the ReturnUri

I use ASP.NET Core MVC app as a client of Openiddict auth server. My MVC app uses cookie authentication and the problem I faced is when the cookie expires and the app redirected to auth server to refresh all the stuff, it doesn't return to the page it pushed from. It returns to Home page.

How do I force my auth server to respect the return uri? http://localhost:5000/login?ReturnUrl=%2FNotHomePage



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source