Firebase autologin (first time to login) workflow for C ++ bindings

I want to get a subj workflow for my program, but I don't want the user passwords / vault passwords to be opened in an open way. What should I use to implement this workflow in my application? Any advice? Thanks.

update: What I have now is a simple application written in Qt / Qml and using the Firebase C ++ api.

At the beginning, I get Firebase :: App and Firebase :: Auth successfully init. After init Auth, I register the AuthStateListener class with simple handler code:

void AuthManager::OnAuthStateChanged(firebase::auth::Auth *auth) { if(auth->CurrentUser()){ qDebug() << "get auth :" << auth->CurrentUser()->Email().c_str(); } else{ qDebug() << "still not auth"; } } 

After starting the application writes to the console the second branch of the log ("still not auth"). And nothing happens yet. Then, in gui, I click on my signIn button and execute SignInWithEmailAndPassword in the button handler. After that, I get a new event in OnAuthStateChanged . Now I have authorized, but not an autologue. Hope it helps. Thanks.

+5
source share
2 answers

The problem is solved by updating Firebase C ++ SDK 2.1.0 (since 9dec 2016)

+1
source

With Firebase, you get an access token after authentication, and Firebase manages the session for you. Thus, there is no need to store the username / password or token.

Instead, you can use AddAuthStateListener to determine when authentication status changes (for example, when a user is logged in).

Please note that if you need to transfer the token to the server process for authentication, you can use the Token method for this, and the Firebase / admin server SDKs include a strategy to verify identifiers .

0
source

Source: https://habr.com/ru/post/1260630/


All Articles