SignInWithEmailAndPassword works differently depending on platform
paxbun opened this issue · 4 comments
I'm developing a desktop program with Firebase, and the following code makes different result in Windows and Ubuntu.
#include <firebase/database.h>
#include <firebase/auth.h>
#include <cstdio>
int main() {
auto app = firebase::App::Create();
auto email = "...";
auto pwd = "...";
auto auth = firebase::auth::Auth::GetAuth(app);
auto value = auth->SignInWithEmailAndPassword(email, pwd);
while (value.status() == firebase::kFutureStatusPending);
if (value.status() != firebase::kFutureStatusComplete) {
printf("Invalid Result.\n");
return 1;
} else if (value.error() != firebase::database::kErrorNone) {
printf("Error %d: %s\n",
value.error(), value.error_message());
return 1;
} else {
return 0;
}
}While in Windows, the program returns 0, in Ubuntu, the program prints Error 1: An internal error has occurred. google-services.json is in the working directory.
@paxbun any chance this prints out more logs than what you're printing out?
You can turn on logging using the private logging method here to get more information.
e.g
namespace firebase {
void LogSetLevel(LogLevel level);
}
int main() {
firebase::SetLogLevel(firebase::kLogLevelVerbose);
.. your stuff ...
}
I changed the log level to verbose, and I got the following results.
#include <firebase/log.h>
#include <firebase/database.h>
#include <firebase/auth.h>
#include <cstdio>
namespace firebase {
extern void LogSetLevel(firebase::LogLevel);
}
int main() {
firebase::LogSetLevel(firebase::LogLevel::kLogLevelVerbose);
auto app = firebase::App::Create();
auto email = "...";
auto pwd = "...";
auto auth = firebase::auth::Auth::GetAuth(app);
auto value = auth->SignInWithEmailAndPassword(email, pwd);
while (value.status() == firebase::kFutureStatusPending);
if (value.status() != firebase::kFutureStatusComplete) {
printf("Invalid Result.\n");
return 1;
} else if (value.error() != firebase::database::kErrorNone) {
printf("Error %d: %s\n",
value.error(), value.error_message());
return 1;
} else {
return 0;
}
}In Windows:
Firebase App initializing app __FIRAPP_DEFAULT (default 1).
DEBUG: Creating firebase::App for Firebase C++ 6.1.0
DEBUG: Added app name=__FIRAPP_DEFAULT: options, api_key=..., app_id=..., database_url=..., messaging_sender_id=..., storage_bucket=..., project_id=... (0xffffffff)
DEBUG: Creating Auth FFFFFFFFFFFFFFFF for App FFFFFFFFFFFFFFFF
DEBUG: Auth state changed. Notifying 1 listeners.
DEBUG: ID token changed. Notifying 1 listeners.
DEBUG: ID token changed. Notifying 1 listeners.
In Ubuntu:
Firebase App initializing app __FIRAPP_DEFAULT (default 1).
DEBUG: Creating firebase::App for Firebase C++ 6.1.0
DEBUG: Added app name=__FIRAPP_DEFAULT: options, api_key=..., app_id=..., database_url=..., messaging_sender_id=..., storage_bucket=..., project_id=... (0xffffffff)
DEBUG: Creating Auth 0xffffffffffff for App 0xffffffffffff
DEBUG: Failed to read user data for app (__FIRAPP_DEFAULT). This could happen if the current user doesn't have access to the keystore, the keystore has been corrupted or the app intentionally deleted
the stored data.
DEBUG: Auth state changed. Notifying 1 listeners.
DEBUG: ID token changed. Notifying 1 listeners.
Error 1: An internal error has occurred.
DEBUG: Failed to read user data for app (__FIRAPP_DEFAULT). This could happen if the current user doesn't have access to the keystore, the keystore has been corrupted or the app intentionally deleted
the stored data.
seems to be the key line here.
Do you have libsecret installed?
The error is coming from
it looks like
is failing
Thanks for your answer. I didn't have libsecret on my Ubuntu machine. It is strange that I need libsecret to generate MakeFile from CMake but I didn't have libsecret though.