Thanks to @ Frank-van-Puffelen's answer, I had some trials until I got something relevant (at least for me: the comment can be improved).
I based my OAuth architecture on three main components: fdsfds
- One AuthStateListener object located in the application.
- One Utils Singleton OAuthManager that handles the entire authentication process
- One or many actions related to Authentification user interaction (Signin buttons, etc.)
Application class
FacebookSdk.sdkInitialize(this);
Firebase.setAndroidContext(this);
Firebase.getDefaultConfig().setLogLevel(Logger.Level.DEBUG);
Firebase.getDefaultConfig().setPersistenceEnabled(true);
Firebase ref = new Firebase("https://<YOUR-FIREBASE-APP>.firebaseio.com");
ref.addAuthStateListener(new Firebase.AuthStateListener() {
@Override
public void onAuthStateChanged(AuthData authData) {
if (authData != null) {
OAuthManager.getDefault().setAuthenticatedUser(authData);
OAuthManager.getDefault().startFetchingUserInfo();
} else {
OAuthManager.getDefault().retrieveOAuth(MilleZimU.getInstance());
}
}
});
OAuthManager
Here are all the services that work with authentication (part was a copy of the demo activity of Firebase)
SignInActivity
Only the part that is associated with interacting with the user interface remains here.
Return?
, , (, - ), , Firebase | Prefs | FacebookSdk. .