Google Smart Lock across multiple apps

独自空忆成欢 提交于 2021-01-24 07:49:40

问题


I've been trying to get Google's Smart Lock to work between two apps that I have (unfortunately with different keystores), but not having any luck.

It's straightforward to save a password in Smart Lock for one app (APP 1) doing something like:

Credential credential = new Credential.Builder(email)
            .setPassword(password)
            .build();
Auth.CredentialsApi.save(mCredentialsApiClient, credential).setResultCallback(...

However, when I try to make a CredentialRequest in APP 2 it's not able to read the same credentials saved from APP 1. I've tried setting the accountType to the same identifier between them like:

Credential credential = new Credential.Builder(email)
            .setPassword(password)
            .setAccountType(ACCOUNT_TYPE)
            .build();
Auth.CredentialsApi.save(mCredentialsApiClient, credential).setResultCallback(...
...
CredentialRequest request = new CredentialRequest.Builder()
            .setAccountTypes(ACCOUNT_TYPE)
            .build();

Auth.CredentialsApi.request(mCredentialsApiClient, request).setResultCallback(...

But I get an exception stating you can't set both the password and accountType on the same credential (which matches what the documentation says).

Anyone tried something similar between two apps? I should note, I'm unable to tie my credentials from the apps up with my website sign in at the moment, so can't use the Digital Asset Links mechanism.


回答1:


For security reasons, the digit asset linking is the only way to associate multiple apps with different package names and signing certificates for password retreival with Smart Lock.

If you can't support credentials from the website yet, then simply exclude the "web" target from the digital asset links file and credentials will only be shared between the apps (but you still have to host the file somewhere and include a link to this file in both app manifests).



来源:https://stackoverflow.com/questions/43119518/google-smart-lock-across-multiple-apps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!