Delete stored credentials

  • Smart Lock for Passwords is deprecated and developers should migrate to Credential Manager for enhanced security and user experience.

  • Credential Manager supports passkey, password, and federated identity authentication, offering greater flexibility and stronger protection.

  • Credentials stored via Smart Lock should be deleted upon failed login attempts or when a user deletes their account within the app.

  • Developers can utilize the CredentialsClient.delete() method to programmatically remove credentials from Smart Lock.

Delete credentials from Smart Lock when either of the following circumstances occur:

  • Signing in with the credentials fails because the account no longer exists or the password is incorrect.
  • The user completes the app's account deletion flow.

To delete credentials, call CredentialsClient.delete():

mCredentialsClient.delete(credential).addOnCompleteListener(
        new OnCompleteListener<Void>() {
            @Override
            public void onComplete(@NonNull Task<Void> task) {
                if (task.isSuccessful()) {
                    // Credential deletion succeeded.
                    // ...
                }
            }
        });