-->

Password from associated website not retrieved in

2019-03-04 16:20发布

问题:

I've associated my https website and app to share stored credentials and received confirmation that the association is live, but when I call the CredentialsApi.request() method in my app, I am not able to retrieve any credentials from my website that were saved with the Chrome password manager. How can I fix this?

回答1:

After submitting the data to associate your app and https website, and receiving confirmation that the association is live, here are some things to check:

  • if you've just saved a new credential, wait a couple minutes for synchronization between Chrome and Android and across devices
  • try a real device (Android 4+) and not an emulator, ensure that the device is running the latest version of Google Play Services (8+) and has an active internet connection
  • ensure that you are signed in to Chrome with the same account as your Android device, and that the account is in good state (doesn't require password re-entry and meets any corp policy requirements, e.g. is in sync and receives push email notifications, for example)
  • if the association just went live recently and you were testing the API integration in the app on your device before it was enabled, visit passwords.google.com and delete any existing entries for your website / app to force removal of any cached data
  • visit your website in Chrome, sign in as normal and save your password when prompted, confirm that the password was saved and appears in chrome://settings/passwords and passwords.google.com under the https domain specified in your association (fully visible if you mouse over the domain shown in the UI)
  • call the API on Android using an apk with package name matching your submission and signed with the same keystore as your Play Store app, keep in mind that the debug keystore may be different if you are in a development environment with non-release keys or you move to another computer.

  • note that if there are multiple credentials available, the API callback may not immediately be success as you might need to handle multiple stored credentials and invoke UI to allow the user to select a credential

Note that if you save a credential in the app, Chrome will offer to auto-fill in web forms on associated https websites after the association has been live for about 24 hours (and the credential will also be available via the Chrome Credentials API). If you're looking for a complete guide to testing a Smart Lock integration, check out this post.