Supported browsers
The SDK opens the authorisation request in a browser installed on the device. By default, it opens only the browsers that Signicat has verified to complete every authentication flow, including app-to-app flows.
The browser it chooses depends on the following conditions:
Default supported browsers
The SDK supports the following browsers by default:
- Chrome:
com.android.chrome - Samsung Internet:
com.sec.android.app.sbrowser - Firefox:
org.mozilla.firefox - Microsoft Edge:
com.microsoft.emmx - Brave:
com.brave.browser - Vivaldi:
com.vivaldi.browser
The SDK also verifies that each of these browsers is signed with its publisher's certificate, so an app that reuses one of these package names is not opened.
Firefox and Microsoft Edge ask the end-user to confirm before they return to your app.
Known unsupported browsers
The following browsers fail some authentication flows, so the SDK does not support them by default:
- Opera, Opera Mini and Opera GX: These browsers lack Custom Tabs support, and they open the redirect App Link in your app only when the end-user chooses to do so from the browser's settings.
- UC Browser: This browser lacks Custom Tabs support, and it opens the redirect App Link in your app only when the end-user chooses to do so from the browser's settings.
- DuckDuckGo: This browser doesn't open App Links in your app during redirects, so app-to-app flows, such as DigiD app-to-app, do not complete.
Support other browsers
To choose which browsers the SDK may open, set browserMatcher on the client before you call login(). A BrowserMatcher receives a BrowserDescriptor for each browser that the SDK considers, and returns whether the SDK may open that browser:
- Kotlin
- Java
// Accept only Chrome and Samsung Internet, when signed by their publishers
val allowedBrowsers = mapOf(
"com.android.chrome" to setOf("7fmduHKTdHHrlMvldlEqAIlSfii1tl35bxj1OXN5Ve8c4lU6URVu4xtSHc3BVZxS6WWJnxMDhIfQN0N0K2NDJg=="),
"com.sec.android.app.sbrowser" to setOf("ABi2fbt8vkzj7SJ8aD5jc4xJFTDFntdkMrYXL3itsvqY1QIw-dZozdop5rgKNxjbrQAd5nntAGpgh9w84O1Xgg=="),
)
client.browserMatcher = BrowserMatcher { browser ->
allowedBrowsers[browser.packageName] == browser.signatureHashes
}
// Accept every browser except Opera. Note: This matcher does not verify publisher signatures.
client.browserMatcher = BrowserMatcher { browser -> browser.packageName != "com.opera.browser" }
// Accept the default supported browsers, and Chrome Beta 140 or later when signed by its publisher.
// To get <CHROME_BETA_SIGNATURE_HASH>, see "Find the signature hash of a browser".
client.browserMatcher = BrowserMatcher { browser ->
BrowserMatcher.DEFAULT_SUPPORTED_BROWSERS.matches(browser) ||
(browser.packageName == "com.chrome.beta" &&
browser.signatureHashes == setOf("<CHROME_BETA_SIGNATURE_HASH>") &&
(browser.version?.substringBefore('.')?.toIntOrNull() ?: 0) >= 140)
}
// Accept only Chrome and Samsung Internet, when signed by their publishers
Map<String, Set<String>> allowedBrowsers = new HashMap<>();
allowedBrowsers.put("com.android.chrome", Collections.singleton("7fmduHKTdHHrlMvldlEqAIlSfii1tl35bxj1OXN5Ve8c4lU6URVu4xtSHc3BVZxS6WWJnxMDhIfQN0N0K2NDJg=="));
allowedBrowsers.put("com.sec.android.app.sbrowser", Collections.singleton("ABi2fbt8vkzj7SJ8aD5jc4xJFTDFntdkMrYXL3itsvqY1QIw-dZozdop5rgKNxjbrQAd5nntAGpgh9w84O1Xgg=="));
client.setBrowserMatcher(browser ->
browser.getSignatureHashes().equals(allowedBrowsers.get(browser.getPackageName())));
// Accept every browser except Opera. Note: This matcher does not verify publisher signatures.
client.setBrowserMatcher(browser -> !browser.getPackageName().equals("com.opera.browser"));
// Accept the default supported browsers, and Chrome Beta 140 or later when signed by its publisher.
// To get <CHROME_BETA_SIGNATURE_HASH>, see "Find the signature hash of a browser".
client.setBrowserMatcher(browser -> {
if (BrowserMatcher.DEFAULT_SUPPORTED_BROWSERS.matches(browser)) {
return true;
}
String majorVersion = browser.getVersion() == null ? "" : browser.getVersion().split("\\.")[0];
return browser.getPackageName().equals("com.chrome.beta")
&& browser.getSignatureHashes().equals(Collections.singleton("<CHROME_BETA_SIGNATURE_HASH>"))
&& majorVersion.matches("\\d{1,9}")
&& Integer.parseInt(majorVersion) >= 140;
});
Your matcher can report the packageName, version and signatureHashes of the browsers it receives. This can help you identify which browsers and versions cause problems and whether they are signed by their publishers. For example, you can send this information to your analytics if your privacy policy allows it.
The SDK can call your matcher several times during one login. For example, it may call the matcher again when an app-to-app flow resumes. It stops as soon as it finds an accepted browser.
The SDK can call your matcher from a background thread or from the thread that calls createOidcCustomTabsIntent(). If you report browsers to your analytics, avoid reporting the same browser more than once. Make this reporting code thread-safe.
- Kotlin
- Java
val reported = ConcurrentHashMap.newKeySet<String>()
client.browserMatcher = BrowserMatcher { browser ->
val signatureHashes = browser.signatureHashes.joinToString(",")
if (reported.add("${browser.packageName}:${browser.version}:$signatureHashes")) {
analytics.log("browser_seen", browser.packageName, browser.version, signatureHashes)
}
BrowserMatcher.DEFAULT_SUPPORTED_BROWSERS.matches(browser)
}
Set<String> reported = ConcurrentHashMap.newKeySet();
client.setBrowserMatcher(browser -> {
String signatureHashes = String.join(",", browser.getSignatureHashes());
if (reported.add(browser.getPackageName() + ":" + browser.getVersion() + ":" + signatureHashes)) {
analytics.log("browser_seen", browser.getPackageName(), browser.getVersion(), signatureHashes);
}
return BrowserMatcher.DEFAULT_SUPPORTED_BROWSERS.matches(browser);
});
For an overview of the available matchers, see the table below:
A browser that supports Custom Tabs can be passed to your matcher twice: first for its Custom Tab, and then for the standalone browser app.
For an overview of the BrowserDescriptor properties, see the table below:
Find the signature hash of a browser
To accept a browser only when its publisher signed it, you need its signatureHashes. To log them, temporarily set a matcher in a debug build of your app that logs every browser and accepts none:
- Kotlin
- Java
if (BuildConfig.DEBUG) {
client.browserMatcher = BrowserMatcher { browser ->
Log.d("BrowserMatcher", browser.toString())
false
}
}
if (BuildConfig.DEBUG) {
client.setBrowserMatcher(browser -> {
Log.d("BrowserMatcher", browser.toString());
return false;
});
}
To find the hash:
- On a test device, install the browser.
- In your debug build, call
login(). The matcher rejects all browsers, so the SDK passes every installed browser to it. Once all browsers have been rejected,login()fails withnoSupportedBrowser. - In Logcat, copy the hash of the browser.
- In your debug build, remove the matcher.
A browser that you install from another app store or as a sideloaded APK can be signed with a different certificate than the Google Play release. If so, then they will also have a different hash.
When no supported browser is installed
When browserMatcher accepts none of the installed browsers, login() fails with the noSupportedBrowser error code and no browser opens.
In this case, ask the end-user to install or enable a supported browser, and then to try again.
To learn how to respond to error codes, see the Error handling page.