in CredentialsQuickstart/app/src/main/java/com/google/example/credentialsbasic/MainActivity.java [356:389]
private void processRetrievedCredential(Credential credential, boolean isHint) {
Log.d(TAG, "Credential Retrieved: " + credential.getId() + ":" +
anonymizePassword(credential.getPassword()));
// If the Credential is not a hint, we should store it an enable the delete button.
// If it is a hint, skip this because a hint cannot be deleted.
if (!isHint) {
showToast("Credential Retrieved");
mCurrentCredential = credential;
findViewById(R.id.button_delete_loaded_credential).setEnabled(true);
} else {
showToast("Credential Hint Retrieved");
}
mEmailField.setText(credential.getId());
mPasswordField.setText(credential.getPassword());
if (!credential.getIdTokens().isEmpty()) {
IdToken idToken = credential.getIdTokens().get(0);
// For the purposes of this sample we are using a background service in place of a real
// web server. The client sends the Id Token to the server which uses the Google
// APIs Client Library for Java to verify the token and gain a signed assertion
// of the user's email address. This can be used to confirm the user's identity
// and sign the user in even without providing a password.
Intent intent = new Intent(this, MockServer.class)
.putExtra(MockServer.EXTRA_IDTOKEN, idToken.getIdToken());
startService(intent);
} else {
// This state is reached if non-Google accounts are added to Gmail:
// https://support.google.com/mail/answer/6078445
Log.d(TAG, "Credential does not contain ID Tokens.");
}
}