Force Passkey to be generated in Google instead of Samsung Pass in an Android Device

75 Views Asked by At

Is there a way to force passkey generation to Google password manager instead of Samsung Pass. The code I share below currently uses the default option chosen by the user in an Android Device. I don't want user to be able to use Samsung Pass since authentication has some bugs on Samsung Pass Passkeys, found out that some apps are forcing google password manager but no documentation at all.

  private fun getCurrentActivity(): Activity? {
    val activityProvider: ActivityProvider = moduleRegistry.getModule(ActivityProvider::class.java)
    return activityProvider.currentActivity
  }

  @ExpoMethod
  fun register(requestJSON: String, promise: Promise) {
    val credentialManager = CredentialManager.create(context)
    val createPublicKeyCredentialRequest = CreatePublicKeyCredentialRequest(requestJSON)
    val currentActivity = getCurrentActivity()

    moduleCoroutineScope.launch {
      try {
        val result = currentActivity?.let { credentialManager.createCredential(it, createPublicKeyCredentialRequest) }
        val response = result?.data?.getString(REGISTRATION_RESPONSE)
        promise.resolve(response)
      } catch (e: CreateCredentialException) {
        promise.reject("Passkey", handleRegistrationException(e))
      }
    }
  }

I tried to create passkey as described in the Android docs yet, if I go to settings in my device and change the default autofill options to Samsung Pass, it creates the passkey in Samsung Pass. I want it to be saved in Google Password Manager, no matter what.

0

There are 0 best solutions below