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).


6 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)

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