Closed span closed 1 year ago
This was converted from a discussion, here is a summary:
On Android, the instagram webview is parsed as a Chrome web view, even when using firefox as main browser. Instagram is not able to open the App Link through the web view.
Mozilla/5.0 (Linux; Android 12; IN2013 Build/RKQ1.211119.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/102.0.5005.125 Mobile Safari/537.36 Instagram 242.0.0.13.111 Android (31/12; 408dpi; 1080x2181; OnePlus; IN2013; OnePlus8; qcom; en_SE; 380288917)
On Ios, the webview user agent is not recognised by the UAParserDeviceDetector
.
Mozilla/5.0 (iPad; CPU OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 Instagram 221.0.0.9.115 (iPad14,1; iPadOS 15_1; sv_SE; sv-SE; scale=2.00; 750x1334; 349031919)
Both these issues result the the "app link" received by /Initialize
is incorrect. Ios always wants a "app.bankid.com" link and firefox on android needs a "bankid:///" link.
I found the most non-destructive way for us to solve this was to:
UAParserDeviceDetector
:
services.AddTransient<IBankIdSupportedDeviceDetector, UAParserDeviceDetector>();
IBankIdLauncher
where the CanUseAppLink
also responds true for unknown iOS browsers....
private static bool CanUseAppLink(BankIdSupportedDevice device)
{
// Only Safari on IOS and Chrome or Edge on Android version >= 6 seems to support
// the https://app.bankid.com/ launch url.
//
// We choose to default all ios devices with unknown browser to use the app link
// though, since ios in-app webviews are detected as unknown but use safari rendering.
return IsSafariOnIos(device)
|| IsUnknownOnIos(device)
|| IsChromeOrEdgeOnAndroid6OrGreater(device);
}
private static bool IsUnknownOnIos(BankIdSupportedDevice device)
{
return device.DeviceOs == BankIdSupportedDeviceOs.Ios
&& device.DeviceBrowser == BankIdSupportedDeviceBrowser.Unknown;
}
...
Note that the "page refresh" bool is unchanged since at least the instagram browser does not reload the page.
Hi!
Sorry for the late reply. I'm really away from the keyboard now during vacation. I will try to look at this in August. Two quick inputs (if that helps your debugging):
If you ned a "debugger" tool, I've built one and released it here: https://demo.activelogin.net/Debugger/Info
That page can help you understand how the current client is detected,.
Not surprised at all.
I've experienced so many issues with the universal link for BankId (https://app.bankid.com/). They shouldn't recommend us using it when it clearly doesn't work for the cases they say.
Glad you found a workaround
I had a look at this now using our "debugger".
- On Android, the instagram webview is parsed as a Chrome web view, even when using firefox as main browser. Instagram is not able to open the App Link through the web view.
Mozilla/5.0 (Linux; Android 12; IN2013 Build/RKQ1.211119.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/102.0.5005.125 Mobile Safari/537.36 Instagram 242.0.0.13.111 Android (31/12; 408dpi; 1080x2181; OnePlus; IN2013; OnePlus8; qcom; en_SE; 380288917)
- On Ios, the webview user agent is not recognised by the
UAParserDeviceDetector
.Mozilla/5.0 (iPad; CPU OS 15_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 Instagram 221.0.0.9.115 (iPad14,1; iPadOS 15_1; sv_SE; sv-SE; scale=2.00; 750x1334; 349031919)
From what I can tell it detects Android and iOS correct and an "Unknown" browser. The "Launch Url" is therefore set to:
Android: bankid:///?autostarttoken=afc686c2-7f36-40df-a973-3339e443c173&redirect=null
iOS: bankid:///?autostarttoken=afc686c2-7f36-40df-a973-3339e443c173&redirect=
Is this not what you experience @span?
Hi! We have the same problem as mentioned above. iOS app webview opens upp BankID, the user authenticates but then Safari is opened instead of returning back to the app. I have tried your debugger app through the webview in the app and launch url is "app.bankid.com". Anyone know how to get this right? What kind of launch url should be used for iOS webview?
I think this could n ow be solved by #339 / #414. Closing this issue.
Discussed in https://github.com/ActiveLogin/ActiveLogin.Authentication/discussions/375