Open Closed

ABP 5.1.2: Login returnUrl is broken !! #2567


User avatar
0
BassaSolutions created
ABP Framework version: v5.1.2
UI type: Blazor Server
DB provider: EF Core
Tiered (MVC) or Identity Server Separated (Angular): no
Steps to reproduce the issue:
  • Load the latest startup template (e.g. 5.1.2)
  • Without logging in, try to open http://localhost:5000/identity/roles
  • You will get forwarded to http://localhost:5000/account/login?returnUrl=http%3A%2F%2Flocalhost%3A5000%2Fidentity%2Froles
  • Now Login
  • You will get redirected to root https://localhost:5000 instead of http://localhost:5000/identity/roles

This is a bad problem! We have "stand alone" webview pages that are part of a mobile application & require a login & then show 1 view. Now the user gets redirected to a different page, breaking the whole application workflow!

This is probably related to

  • https://support.abp.io/QA/Questions/2516/Bug-setting-management-refresh-crashes
  • https://github.com/abpframework/abp/issues/11515

I hope this can get highly prioritized.


6 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    You will get forwarded to https://localhost:5000/account/login?returnUrl=https://localhost:44313/identity/roles

    Maybe you should start https://localhost:44313.

  • User Avatar
    0
    BassaSolutions created

    Sorry, this was a wrong copy paste, as I copied the redirect part from the template application. On our application, everything is configured with port 5000. The redirect URL also shows port 5000. http://localhost:5000/account/login?returnUrl=http%3A%2F%2Flocalhost%3A5000%2Fidentity%2Froles

    With the new 5.1.2 startup template it works. In our application it fails (redirects to root).

    The difference is that we migrated our application from 4.3 to 5.1.2, so we might still have some 4.3 startup code in that does not work with 5.1.2

    The difference in the LOG when redirecting is (This log occurs after successful authentication):

    Microsoft.AspNetCore.Hosting.Diagnostics: 08:54:06,250 INFO  Microsoft.AspNetCore.Hosting.Diagnostics - Request finished HTTP/1.1 POST http://localhost:5000/account/login?returnUrl=http%3A%2F%2Flocalhost%3A5000%2Fidentity%2Froles application/x-www-form-urlencoded 318 - 302 - - 605.3844ms
    Microsoft.AspNetCore.Hosting.Diagnostics: 08:54:06,253 INFO  Microsoft.AspNetCore.Hosting.Diagnostics - Request starting HTTP/1.1 GET http://localhost:5000/ - -
    Microsoft.AspNetCore.Routing.Matching.DfaMatcher: 08:54:06,257 DEBUG Microsoft.AspNetCore.Routing.Matching.DfaMatcher - 2 candidate(s) found for the request path '/'
    Microsoft.AspNetCore.Routing.Matching.DfaMatcher: 08:54:06,259 DEBUG Microsoft.AspNetCore.Routing.Matching.DfaMatcher - Endpoint '/_Host' with route pattern '' is valid for the request path '/'
    Microsoft.AspNetCore.Routing.Matching.DfaMatcher: 08:54:06,261 DEBUG Microsoft.AspNetCore.Routing.Matching.DfaMatcher - Endpoint 'Fallback {*path:nonfile}' with route pattern '{*path:nonfile}' is valid for the request path '/'
    Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware: 08:54:06,263 DEBUG Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware - Request matched endpoint '/_Host'
    Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler: 08:54:06,267 DEBUG Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler - AuthenticationScheme: Identity.Application was successfully authenticated.
    Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler: 08:54:06,270 DEBUG Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler - AuthenticationScheme: Identity.Application was successfully authenticated.
    Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler: 08:54:06,272 DEBUG Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationHandler - AuthenticationScheme: Identity.Application was successfully authenticated.
    Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware: 08:54:06,275 DEBUG Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware - Static files was skipped as the request already matched an endpoint.
    Microsoft.AspNetCore.Routing.EndpointMiddleware: 08:54:06,277 INFO  Microsoft.AspNetCore.Routing.EndpointMiddleware - Executing endpoint '/_Host'
    

    It seems to find 2 routes when executing the redirect? This seems similar to the first bug that 5.0 had, where all sub-paths did not work with blazor, and 5.1 introduced options.EnableRazorRuntimeCompilationOnDevelopment = false; to fix it. Is there something additional that has to be done for the login redirects?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    introduced options.EnableRazorRuntimeCompilationOnDevelopment = false; to fix

    hi

    You just need to configure it and no other is needed.

  • User Avatar
    0
    BassaSolutions created

    introduced options.EnableRazorRuntimeCompilationOnDevelopment = false; to fix

    hi

    You just need to configure it and no other is needed.

    Yes, we already configured it. That fixed all redirections beeing broken in 5.0.

    Now with 5.1.2, we still have 1 problem: redirecting not working AFTER login.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Can you try this?

    https://github.com/abpframework/abp/issues/10899#issuecomment-989840821

  • User Avatar
    0
    BassaSolutions created

    This fixed it, thank you!

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11