Open Closed

[BUG] Login page in browser does not redirect #7323


User avatar
0
improwise created
  • ABP Framework version: 8.1
  • UI Type: MAUI (Blazor)
  • Database System: EF

There seem to be a problem with authentication in the browser when running the Mobile MAUI client generated by ABP Suite. The page does what it should and the app gets logged into, however, one you have clicked the login button, the page in the web browser never change, it still remains on the login form and there is no indication to the user that login is completed and they can close the browser window.

This is how it looks after login is completed, ie exactly the same as it did before login.

We have mostly seen this when running the MAUI app as a Windows App (Windows Emulator).


16 Answer(s)
  • User Avatar
    0
    improwise created

    Can add that there does not seem to be any relevant log entries in the Web browser console and as mentioned above, the login in itself actually works, so this is probably something that should be solved by login page refresh to show that login is completed and the browser window can be closed.

  • User Avatar
    0
    improwise created

    Still waiting for a reply here.

    @enisn

  • User Avatar
    0
    improwise created

    Still waiting for a reply...

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Hi,

    MAUI implements the default behaviour of OAuth login and redirects to browser to login. And browser redirect back to the application with a specific scheme like (yourapp://callback). By default it should open your application and bring it to the front. But I reproduced the same scenario as you said, it stays in the background but login operation is completed. Here is the 2 cases:

    • We can implement a new page after redirection to different schemes than http(s)://
    • We can implement the logic in the MAUI app that brings to the front itself on the desktop apps and use can recognize that the login operation is done.
  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    On the MAUI, all the codes inside in your application, an you try adding the following code-block into your LoginOrLogoutViewModel.cs at the end of the LoginOrLogout() method:

    #if WINDOWS
    if (App.Current?.Windows.LastOrDefault()?.Handler.PlatformView is Microsoft.UI.Xaml.Window window)
    {
        // Bring the main window in the front
        window.Activate();
    }
    #endif
    
  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    It's already done by MAUI but it seems WinUI3 has a problem with that Activate() method: https://github.com/microsoft/microsoft-ui-xaml/issues/7595

    It brings too complex solutions,

    It seems this one is good: https://stackoverflow.com/a/12758966/7200126 But still I recommend waiting WinUI3 to fix it. In our side we'll add another page when redirect uri scheme is different than http(s)

  • User Avatar
    0
    improwise created

    Hi,

    MAUI implements the default behaviour of OAuth login and redirects to browser to login. And browser redirect back to the application with a specific scheme like (yourapp://callback). By default it should open your application and bring it to the front. But I reproduced the same scenario as you said, it stays in the background but login operation is completed. Here is the 2 cases:

    • We can implement a new page after redirection to different schemes than http(s)://
    • We can implement the logic in the MAUI app that brings to the front itself on the desktop apps and use can recognize that the login operation is done.

    Thanks.

  • User Avatar
    0
    improwise created

    It's already done by MAUI but it seems WinUI3 has a problem with that Activate() method: https://github.com/microsoft/microsoft-ui-xaml/issues/7595

    It brings too complex solutions,

    It seems this one is good: https://stackoverflow.com/a/12758966/7200126 But still I recommend waiting WinUI3 to fix it. In our side we'll add another page when redirect uri scheme is different than http(s)

    At least some confirmation to the user that authentication was successful goes a long way and should also be independent from redirects etc. ie quite easy to implement. As of now, it just looks like nothing happened unless you know what to look for.

  • User Avatar
    0
    improwise created

    Seems like this is being handled here now

    https://github.com/abpframework/abp/issues/20078

    Would be nice if there were a way to know this, I just happened to see this by luck as I don't normally scroll through every issue, is there a way to see GH issues related with support tickets here?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    THe issue has been fixed

    https://github.com/volosoft/volo/pull/17940

  • User Avatar
    0
    improwise created

    THe issue has been fixed

    https://github.com/volosoft/volo/pull/17940

    Is that a public repo as the link isn't working?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    sorry, this is a private link

  • User Avatar
    0
    improwise created

    sorry, this is a private link

    Seems much better than before.

    Also, thanks for keeping me/us updated on the progress here

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    :)

  • User Avatar
    0
    improwise created

    Will you please refund ticket with this being a confirmed bug/problem? Thanks.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    okay,

    Actually, this is Microsoft's problem, they don't officially support Windows yet

    https://learn.microsoft.com/en-us/dotnet/maui/platform-integration/communication/authentication?view=net-maui-8.0&tabs=windows

Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11