Firebase + Android + Spring to create microservices

0

The idea is this:

I have an application in android that will consume my services that I will create using Spring. However, these services must have some security, where only people authenticated in my application can consume such services.

Already in my Android application I will use Firebase to control the authentications, using email and password. So, I will not need to configure any security on my server, such as using Spring OAuth2.

My question is: Once the user authenticates in my application and then he wants to consume some service that I made available using Spring on the Server, such as a GET LIST of something, how do I validate that the user is authenticated in my application, so I can give it access to the requested service?

    
asked by anonymous 02.07.2016 / 18:43

1 answer

0

You can check if it's logged in, by documentation we have the following method:

mAuthListener = new FirebaseAuth.AuthStateListener() {
        @Override
        public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
            FirebaseUser user = firebaseAuth.getCurrentUser();
            if (user != null) {
                // User is signed in
                Log.d(TAG, "onAuthStateChanged:signed_in:" + user.getUid());
            } else {
                // User is signed out
                Log.d(TAG, "onAuthStateChanged:signed_out");
            }
            // ...
        }
    };
    
07.07.2016 / 18:30