Reputation: 1598
I want to reach a user profile page. how can call a specific user with firebaseAuth. this code gives me only current user. how can call a user with user id.
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
are there any code like this:
FirebaseUser user = FirebaseAuth.getInstance().getUser(mywantuserID);
why I want to use FirebaseAuth otherwise profile updates will take my time.
Upvotes: 2
Views: 3183
Reputation: 2557
I believe the FirebaseAuth object only has the capability to get the currently signed-in user's details.
Maybe you could create a User object in your schema and have the UID from the Firebase Users as the key:
users
---UID
------first_name
------last_name
------etc...
And then with that, you get a user's ID with a simple Firebase Query like:
FirebaseDatabase.getReference('users').orderByKey().equalTo(yourUID)
Upvotes: 1
Reputation: 5339
if you need an other user detail you need to store what you need at the firebase you can't use the auth method
Upvotes: 1
Reputation: 1925
To get user uid, simple use user.geUid();, for example:
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
String userUid = user.getUid());
Upvotes: -1