Android Client SDK

The Android client SDK gives users the ability to leverage their device’s built-in fingerprint sensor and/or FIDO security keys for secure passwordless access to websites and native applications that support the FIDO2 protocols.



Apache Maven


In your AndroidManifest.xml, add the following permissions:

<uses-permission android:name="android.permission.INTERNET" />

Configuration (Android application)

Somewhere in your Android application, configure PasswordlessOptions.

data class PasswordlessOptions(
   // Your public API key
   val apiKey: String,

   // Identifier for your server, for example '' if your backend is hosted at
   val rpId: String,

   // This is where your Facet ID goes
   val origin: String,

   // Where your backend is hosted
   val backendUrl:String,

   // server, change for self-hosting
   val apiUrl: String = ""

In your application's AndroidManifest.xml, add the following tag under manifest::application:

  android:resource="@xml/assetlinks" />

In your application's res/xml/assetlinks.xml, you will then need to add the following content. This will tell our Android application where your .well-known/assetlinks.json file is hosted.

<?xml version="1.0" encoding="utf-8"?>
    <string name="assetlinks"></string>

Facet ID

The Facet ID will be used later in this guide as the origin.

To obtain the Facet ID continue the steps below, the Facet ID typically looks like:


  1. Execute the following command in your terminal:
# Linux, Mac OS, Git Bash, ...
keytool -list -v -keystore ~/.android/debug.keystore | grep "SHA256: " | cut -d " " -f 3 | xxd -r -p | basenc --base64url | sed 's/=//g'
  1. The default password for the debug keystore is android. For your production keystore, enter your chosen password.

  2. Now append the result to android:apk-key-hash: to get the Facet ID:

Configuration (Your back-end)

Obtaining the SHA-256 Certificate Fingerprints

To configure your backend, you'll need to host a .well-known/assetlinks.json file at the root of your domain. This file contains a list of SHA-256 certificate fingerprints that are allowed to authenticate with your backend.

The following command will print detailed information about the keystore entry with the specified alias, including information about the certificate, its validity, and other details. It's commonly used in Android development to verify the properties of the debug keystore and the associated key used for signing applications during development.


Go to the root directory of the project from the terminal and run the below command:

./gradlew signingReport

Put this SHA256 along with your root Android package name in your backend to generate assetlinks.json for your app at
If you are using example-nodejs-backend, then just put these 2 values in your .env file.

You will need store the following file at https://<your-domain>/.well-known/assetlinks.json. To generate the SHA256 hash, read the links below the snippet.

You may also have to change the 'target::namespace' and 'target::package_name' properties to match your application's.

    "relation": [
    "target": {
      "namespace": "web"
    "relation": [
    "target": {
      "namespace": "android_app",
      "package_name": "com.example.myapplication",
      "sha256_cert_fingerprints": [

Using the PasswordlessClient

With Dagger Hilt

You can either set the ActivityContext and CoroutineScope by injecting it with Dagger Hilt as follows:

class PasswordlessModule {
    fun provideLifecycleCoroutineScope(activity: Activity): LifecycleCoroutineScope =
        (activity as AppCompatActivity).lifecycleScope

    fun providePasswordlessClient(
        @ActivityContext activity: Context, scope: LifecycleCoroutineScope): PasswordlessClient {
        val options = PasswordlessOptions(

        return PasswordlessClient(options, activity, scope)


  1. UI:
    • (Required) Specify the username for the credential.
    • (Optional) Take the alias as input from the user if it's a non-discoverable credential.
  2. Call POST /register/token implemented in your backend: Your backend should call the API to generate a registration token.
  3. Call PasswordlessClient.register():
// Pass the registration token to PasswordlessClient.register()
    token = responseToken,
    nickname = nickname
) { success, exception, result ->
    if (success) {
        Toast.makeText(context, result.toString(), Toast.LENGTH_SHORT).show()
    } else {
        Toast.makeText(context, "Exception: " + getPasskeyFailureMessage(exception as Exception), Toast.LENGTH_SHORT).show()

Logging in

  1. UI: Optionally, take the alias as input from the user if it's a non-discoverable credential.
  2. Call PasswordlessClient.login(): Initiate the login process with the (optional) alias and response callback.
  3. Call POST /signin/verify implemented in your backend: Your backend should call the API to generate a login token.
// Call PasswordlessClient.login() with the alias
_passwordless.login(alias) { success, exception, result ->
    if (success) {
        lifecycleScope.launch {
            // When successful, call your backend to verify the token, which could for example return a JWT token.
            val clientDataResponse = httpClient.login(UserLoginRequest(result?.token!!))
            if (clientDataResponse.isSuccessful) {
                // Login successful. Parse the response or JWT token and proceed.
                val data = clientDataResponse.body()
    } else {


You can find the source code for a sample application hereopen in new window.

Registration 1

Registration #1