Firebase + Android + Spring to create Microservices

Asked

Viewed 147 times

0

The idea is this:

I have an android application that will consume my services that I will create using Spring. However, these services should 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 authentications, using email and password. So I won’t need to set up anything security on my server, like using Spring Oauth2.

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

1 answer

0

You can check if he is 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");
            }
            // ...
        }
    };

Browser other questions tagged

You are not signed in. Login or sign up in order to post.