这是我试图在 Android 上实现的来自 iOS 的工作流:
- 用户首次启动应用并使用凭据成功登录(发送到 API 进行验证)。
- 提示显示要求注册 Touch ID
- 用户选择 YES => 用户名/密码存储在钥匙串(keychain)中
- 用户注销、关闭并重新启动应用。
- 提示要求使用指纹验证
- 用户使用指纹进行身份验证 => 从钥匙串(keychain)中检索用户名/密码,然后将其发送到 API
是否有 iOS 的 Keychain API 的 Android 等价物?据我所知,Keystore 似乎只能存储 key 和证书。
最佳答案
这里是:
By integrating Smart Lock for Passwords into your Android app, you can automatically sign users in to your app using the credentials they have saved. Users can save both username-password credentials and federated identity provider credentials.
Integrate Smart Lock for Passwords into your app by using the Credentials API to retrieve saved credentials on sign-in. Use successfully retrieved credentials to sign the user in, or use the Credentials API to rapidly on-board new users by partially completing your app's sign in or sign up form. Prompt users after sign-in or sign-up to store their credentials for future automatic authentication.
https://developers.google.com/identity/smartlock-passwords/android/
关于Android M - 类似钥匙串(keychain)的用户名/密码存储,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34448221/