1

I'm developing an app and 've implemented smart lock.

The problem is that at first, having several google accounts in my phone, when I press login, a smart lock modal appears saying.. Continue with.. And then a list of all my accounts appear (even if I didn't use those accounts in my app, or in any other app, for example I have one for google calendar exclusively, and it shows) at the end I press none of the above. Then I enter the credentials and they are correctly saved.

After that, everything works as expected, meaning that after closing the app and reopened, the smart lock correctly autocomplete the credentials and I correctly enter.

I wonder what I'm missing, if I enter to spotify they just show the accounts where I previously login, not all.

I've found some extra info but apparently no valid answers.

Smart Lock multi account resolution always showing up

Smart Lock shows accounts not from my app

Just in case the question is not clear.. How can I filter the previously used accounts in my domain or app? Or how can take out that modal (now it's acting just like autofiller in case any of the shown emails matches the one you're looking for.

TrOnNe
  • 1,632
  • 16
  • 30

2 Answers2

0

I think what you're looking for is here

https://developers.google.com/identity/smartlock-passwords/android/associate-apps-and-sites

Add that json file and the application, and you would be set

pepe pepe
  • 176
  • 3
0

It's been a long time since the question was published, but I'm going to answer it anyways for the sake of documentation.

When you request Credentials but the user has not saved any credentials before, you will receive an error of type ResolvableApiException and status code SIGN_IN_REQUIRED. If you try to resolve it by invoking startResolutionForResult(), the Google SDK will show a dialog with some unrelated accounts which do NOT contain passwords. This is the same dialog that appears when using the Hint Picker feature. It's not very obvious from the documentation, but this is what I saw after manual tests.

To avoid this, you must check that the error code is exactly RESOLUTION_REQUIRED before requesting resolution.

client.request(credentialRequest)
  .addOnSuccessListener { response ->
    // ...
  }
  .addOnFailureListener { exception ->
    if (exception is ResolvableApiException && exception.statusCode == RESOLUTION_REQUIRED) {
      exception.startResolutionForResult(activity, REQUEST_CODE)
    }
Sloy
  • 2,975
  • 3
  • 20
  • 21