ActiveLogin / ActiveLogin.Authentication

Support Swedish BankID (svenskt BankID) authentication in .NET. Unofficial package, not created by BankID.
https://activelogin.net
MIT License
216 stars 75 forks source link

AddCustomBrowserByUserAgent should always override regardless of device #442

Closed robynactive closed 8 months ago

robynactive commented 8 months ago

I have a TWA (wrapped PWA) and instead of faking the user agent to be the correct device by adding iPhone and so on do I rather want the AddCustomBrowserByUserAgent to override regardless what device it is.

Right now is the default device android if no device is matching with the user agent which means no custom redirect url override.

The solution could be like this:

In BankIdLauncher do I want the code on line 148 to be moved up to 139.

Like this:


private static string GetRedirectUrl(BankIdSupportedDevice device, LaunchUrlRequest request, BankIdLauncherCustomBrowserConfig? customBrowserConfig)
    {
        if (customBrowserConfig != null && customBrowserConfig.IosReturnUrl != null)
        {
            return customBrowserConfig.IosReturnUrl;
        }

        // Only use redirect url for iOS as recommended in BankID Guidelines 3.1.2
        return device.DeviceOs == BankIdSupportedDeviceOs.Ios
            ? GetIOsBrowserSpecificRedirectUrl(device, request.RedirectUrl, customBrowserConfig)
            : NullRedirectUrl;
    }
PeterOrneholm commented 8 months ago

Good catch! Didn't think of this. Then we should also change the name to ReturnUrl instead of IosReturnUrl. Are you up for a PR?

robynactive commented 8 months ago

I can do that. But I do not have the permissions it seems. I tried to create a new branch with the changes and push it but got back:

Remote: Permission to ActiveLogin/ActiveLogin.Authentication.git denied to robynactive.
Error encountered while pushing to the remote repository: Git failed with a fatal error.
Git failed with a fatal error.
unable to access 'https://github.com/ActiveLogin/ActiveLogin.Authentication.git/': The requested URL returned error: 403