标签: google-smartlockpasswords

未调用 Android Smart Lock setResultCallback

我一直在关注https://developers.google.com/identity/smartlock-passwords/android/retrieve-credentials以尝试自动登录用户,如果他们已将凭据保存到 chrome 中的新 Android Smart Lock 功能。我完全遵循了指南,但是我传递给 setResultCallback() 的回调没有被调用。有没有人遇到过这个问题?

没有错误消息或任何东西,只是没有被调用。

android credentials google-play-services google-smartlockpasswords

4
推荐指数
1
解决办法
1694
查看次数

Smart Lock for Passwords登录提示来自何处以及如何自定义?

在Google Play Services v8.3中,Google添加了一种向用户提供登录帐户"提示"的方法 - 用于选择以前使用过的电子邮件以注册应用的用户界面.

在此输入图像描述

有关详细信息,请参见此处

我想知道Google在哪个地方显示该屏幕中显示的电子邮件,在我的设备上测试它我看到了一些我之前签署过的旧的/未使用过的电子邮件.

有没有办法对其进行自定义,以便只有设备上设置的电子邮件才会显示在提示屏幕中?

android google-play-services google-smartlockpasswords

4
推荐指数
1
解决办法
1089
查看次数

如何使用 Fragment 来启动 Smartlock 保存而不是使用 Activity

我刚刚意识到,当我为 Android 应用程序进行重构时,smartlock api 不允许我将 Fragment 传递给 ResolvingResultCallbacks 对象。

API 只允许我将 Activity 作为上下文传递,这意味着我需要在 Activity 的 onActivityResult() 方法而不是 Fragment 方法中处理凭据结果。但是在我们应用程序的当前设计中,我们希望 Fragment 处理智能锁逻辑。

这是我的保存代码:

 Auth.CredentialsApi.save(mSmartLockApiClient, credential).setResultCallback(
     new ResolvingResultCallbacks<Status>(mActivity, RC_CREDENTIALS_SAVE) {
       @Override
       public void onSuccess(Status status) {                               
         mSmartLockSaveCallBack.onSuccess();
       }

       @Override
       public void onUnresolvableFailure(Status status) {}
     });
Run Code Online (Sandbox Code Playgroud)

实际上,对于请求凭据,我遇到了同样的问题,api 没有提供传递片段以开始解析的方法。但我找到了一个解决方法:

 if (status.hasResolution()) {
   mFragment.startIntentSenderForResult(
       status.getResolution().getIntentSender(), 
       RC_CREDENTIALS_READ, 
       null, 
       0, 
       0, 
       0, 
       null);
}
Run Code Online (Sandbox Code Playgroud)

android android-fragments google-smartlockpasswords

4
推荐指数
1
解决办法
369
查看次数

如何为Android应用程序实施密码的智能锁定

有没有人知道Smart Lock?它是如何工作的?

我想在Android应用程序中开发一个为密码实现Smart Lock的应用程序.

我关注的是https://developers.google.com/identity/smartlock-passwords/android/.

我已经初始化了 GoogleApiClient

 mCredentialsApiClient = new GoogleApiClient.Builder(this)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .addApi(Auth.CREDENTIALS_API)
            .build();
Run Code Online (Sandbox Code Playgroud)

并生成Credentialas的实例

 final Credential credential = new Credential.Builder(email)
            .setPassword(password)
            .build();
Run Code Online (Sandbox Code Playgroud)

用来保存凭证Credentials API,我用过

Auth.CredentialsApi.save(mCredentialsClient, credential).setResultCallback(
 new ResultCallback() {
  @Override
  public void onResult(Status status) {
      if (status.isSuccess()) {
          // Credentials were saved
      } else {
          if (status.hasResolution()) {
              // Try to resolve the save request. This will prompt the user if
              // the credential is new.
              try {
                  status.startResolutionForResult(this, RC_SAVE);
              } catch …
Run Code Online (Sandbox Code Playgroud)

android credentials google-play-services google-smartlockpasswords

3
推荐指数
1
解决办法
1814
查看次数

智能锁密码无法在某些手机上运行,​​错误消息"此设备上没有合格的帐户"

当我运行快速启动示例时:https://github.com/googlesamples/android-credentials/

在运行Marshmallow的Nexus 6上,凭据已成功保存.

但是,在带有棒棒糖(5.1.1)的三星Note 5上,我得到:

11-25 14:45:27.581 11428-11428/com.google.example.credentialsbasic D/MainActivity: Save Failed:Status{statusCode=No eligible accounts on this device for the credentials API., resolution=null}
Run Code Online (Sandbox Code Playgroud)

据Google Smart Lock for Password默认启用,我在三星设置中找不到它的设置.这是否意味着三星手机不支持Smart Lock for Passwords?这是一个真正只适用于Nexuses的功能吗?

我在设备支持或我提供的错误消息方面找不到任何相关文档.

android google-play-services google-smartlockpasswords

2
推荐指数
1
解决办法
1267
查看次数

Google Smart Lock for Passwords - 应用程序是否可以看到联合凭据密码?(例如,保存用户的 Facebook 或 Google 登录操作时)

我想知道这里是否存在安全问题?任何使用 google 智能锁的应用程序都会知道用户的 google、twitter 等帐户凭据,对吗?看看这个谷歌教程here,在credentialsRetrieved回调中,Credential对象具有应用程序可以访问的用户用户名和密码。但是现在应用程序知道用户的 google 或 twitter 帐户?这是我正在谈论的代码:

 private void onCredentialRetrieved(Credential credential) {
    String accountType = credential.getAccountType();
    if (accountType == null) {
        // Sign the user in with information from the Credential. 
//right here we have the users login credentials, dont we ??  There exposed. 
        signInWithPassword(credential.getId(), credential.getPassword());
    } else if (accountType.equals(IdentityProviders.GOOGLE)) {
        // The user has previously signed in with Google Sign-In. Silently
        // sign in the user with the same ID.
        // See https://developers.google.com/identity/sign-in/android/
        GoogleSignInOptions gso …
Run Code Online (Sandbox Code Playgroud)

android google-smartlockpasswords

2
推荐指数
1
解决办法
1448
查看次数

关联网站的密码未通过 Smart Lock API 在应用中检索

我已将我的 https 网站和应用程序关联以共享存储的凭据,并收到关联已生效的确认,但是当我CredentialsApi.request()在我的应用程序中调用该方法时,我无法从我的网站检索任何使用 Chrome 密码保存的凭据经理。我怎样才能解决这个问题?

android google-chrome google-smartlockpasswords

1
推荐指数
1
解决办法
799
查看次数

Smart Lock 显示不是来自我的应用程序的帐户

我正在我的应用程序上实施谷歌智能锁,目前,我们只在应用程序端实施,一旦用户允许保存凭据,例如在重新安装时自动登录。但是,当我从 password.google.com 中删除密码时,或者当我在 Google 帐户没有为该应用程序存储凭据的设备上运行该应用程序时,库会显示一个对话框,建议其他网站和应用程序电子邮件。我需要禁用此行为,我只想建议凭据和电子邮件(如果它们属于我的应用程序)。

我正在使用以下代码请求凭据:

    private void requestCredentials() {
            CredentialRequest request = new CredentialRequest.Builder()
                   .setPasswordLoginSupported(true)
                   .setIdTokenRequested(true)
                   .build();
            mProgressSmartLock.show();
    credentialsClient.request(request).addOnCompleteListener(credentialsApiRequestCompleteListener());
    }
Run Code Online (Sandbox Code Playgroud)

和听众:

    public OnCompleteListener<CredentialRequestResponse> credentialsApiRequestCompleteListener(){
            return new OnCompleteListener<CredentialRequestResponse>() {
                @Override
                public void onComplete(@NonNull Task<CredentialRequestResponse> task) {
                // Successfully read the credential without any user interaction, this
                // means there was only a single credential and the user has auto
                // sign-in enabled.
                mProgressSmartLock.dismiss();
                if (task.isSuccessful()) {
                    processRetrievedCredential(task.getResult().getCredential());
                    return;
                }

                    // This is most likely the case where the user has …
Run Code Online (Sandbox Code Playgroud)

android google-play-services google-smartlockpasswords google-play-services-3.3.0 play-services-auth-base-license

1
推荐指数
1
解决办法
1073
查看次数

启用自动填充时,不会使用 Smart Lock API 保存密码凭据

我目前正在 Android 应用程序中实现密码智能锁,我正在遵循文档: https: //developers.google.com/identity/smartlock-passwords/android/store-credentials

在 android Oreo 及以上版本中有此自动填充功能,并且我确实在字段中看到了自动填充弹出窗口,我的问题是在尝试保存凭据时,出现错误:

16: Credentials API's save confirmation dialog has been disabled to avoid conflicts with the Android Autofill feature. This choice may be overridden via CredentialsOptions.

我在其他帖子中读过,这是一个预期的错误,它是为了防止它所说的conflicts with the Android Autofill feature,但我没有看到任何其他对话框来确认保存凭据。

我尝试使用模拟器和真实设备,得到相同的结果。然后我尝试按照文档强制显示智能锁密码保存对话框:

构建 CredentialsClient 时,通过 CredentialsOptions 为所有平台启用保存确认对话框。

CredentialsOptions options = new CredentialsOptions.Builder()
        .forceEnableSaveDialog()
        .build();
mCredentialsClient = Credentials.getClient(this, options);
Run Code Online (Sandbox Code Playgroud)

通过将与登录字段关联的根视图标记为对自动填充不重要来抑制自动填充保存对话框:

<!-- Mark the root view with android:importantForAutofill="noExcludeDescendants" -->
<LinearLayout
    android:importantForAutofill="noExcludeDescendants"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">
    <!-- ... -->
</LinearLayout>     
Run Code Online (Sandbox Code Playgroud)

我做到了并且成功了,保存时显示了对话框,但是自动填充功能消失了(如预期的那样),而且我需要弹出窗口,这是我的要求的一部分。

我还尝试仅应用CredentialsOptions options …

android autofill google-smartlockpasswords

1
推荐指数
1
解决办法
1691
查看次数