Skip to content

Commit 614c00d

Browse files
cynthiajianga-maurice
authored andcommitted
[Auth] Lower the log level to debug if no entry found, since that's a valid case.
PiperOrigin-RevId: 246214128
1 parent 205bb8e commit 614c00d

File tree

3 files changed

+11
-26
lines changed

3 files changed

+11
-26
lines changed

auth/src/desktop/secure/user_secure_data_handle.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ enum UserSecureFn {
3535
enum UserSecureFutureResult {
3636
kSuccess,
3737
kNoEntry,
38-
kNoInternal,
3938
};
4039

4140
template <typename T>

auth/src/desktop/secure/user_secure_manager.cc

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,18 @@ Future<std::string> UserSecureManager::LoadUserData(
8181
auto callback = NewCallback(
8282
[](ThisRef ref, SharedPtr<UserSecureDataHandle<std::string>> handle,
8383
UserSecureInternal* internal) {
84-
if (internal == nullptr) {
85-
handle->future_api->Complete(handle->future_handle, kNoInternal,
86-
"manager doesn't have valid internal");
87-
return;
88-
}
84+
FIREBASE_ASSERT(internal);
8985
ThisRefLock lock(&ref);
9086
if (lock.GetReference() != nullptr) {
9187
std::string result = internal->LoadUserData(handle->app_name);
9288
std::string empty_str("");
9389
if (result.empty()) {
94-
std::string message("No entry for key:" + handle->app_name);
90+
std::string message(
91+
"Authentication failed to read user credentials for app (" +
92+
handle->app_name +
93+
"). This could happen if the current user doesn't have access "
94+
"to the key store, the key store has been corrupted or the app "
95+
"intentionally signed out the user.");
9596
handle->future_api->CompleteWithResult(
9697
handle->future_handle, kNoEntry, message.c_str(), empty_str);
9798
} else {
@@ -115,11 +116,7 @@ Future<void> UserSecureManager::SaveUserData(const std::string& app_name,
115116
auto callback = NewCallback(
116117
[](ThisRef ref, SharedPtr<UserSecureDataHandle<void>> handle,
117118
UserSecureInternal* internal) {
118-
if (internal == nullptr) {
119-
handle->future_api->Complete(handle->future_handle, kNoInternal,
120-
"manager doesn't have valid internal");
121-
return;
122-
}
119+
FIREBASE_ASSERT(internal);
123120
ThisRefLock lock(&ref);
124121
if (lock.GetReference() != nullptr) {
125122
internal->SaveUserData(handle->app_name, handle->user_data);
@@ -140,11 +137,7 @@ Future<void> UserSecureManager::DeleteUserData(const std::string& app_name) {
140137
auto callback = NewCallback(
141138
[](ThisRef ref, SharedPtr<UserSecureDataHandle<void>> handle,
142139
UserSecureInternal* internal) {
143-
if (internal == nullptr) {
144-
handle->future_api->Complete(handle->future_handle, kNoInternal,
145-
"manager doesn't have valid internal");
146-
return;
147-
}
140+
FIREBASE_ASSERT(internal);
148141
ThisRefLock lock(&ref);
149142
if (lock.GetReference() != nullptr) {
150143
internal->DeleteUserData(handle->app_name);
@@ -165,11 +158,7 @@ Future<void> UserSecureManager::DeleteAllData() {
165158
auto callback = NewCallback(
166159
[](ThisRef ref, SharedPtr<UserSecureDataHandle<void>> handle,
167160
UserSecureInternal* internal) {
168-
if (internal == nullptr) {
169-
handle->future_api->Complete(handle->future_handle, kNoInternal,
170-
"manager doesn't have valid internal");
171-
return;
172-
}
161+
FIREBASE_ASSERT(internal);
173162
ThisRefLock lock(&ref);
174163
if (lock.GetReference() != nullptr) {
175164
internal->DeleteAllData();

auth/src/desktop/user_desktop.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -414,10 +414,7 @@ void UserDataPersist::OnAuthStateChanged(Auth* auth) { // NOLINT
414414

415415
void AssignLoadedData(const Future<std::string>& future, void* auth_data) {
416416
if (future.error() == secure::kNoEntry) {
417-
LogWarning("Future no entry: %s", future.error_message());
418-
return;
419-
} else if (future.error() == secure::kNoInternal) {
420-
LogError("Future error: %s", future.error_message());
417+
LogDebug(future.error_message());
421418
return;
422419
}
423420

0 commit comments

Comments
 (0)