In many cases, having a user dashboard populated with the user's profile information is the way to go. This works well, especially if you have a Firebase-powered business application. The Firebase auth API offers an easy way to retrieve the currently authenticated user's metadata information, and in this recipe, we're going to see how we can do just that.
Implementing user metadata retrieval
How to do it...
- In the authentication section within your code, exploit the currentUser() function, as shown in the following code block:
var user = firebase.auth().currentUser;
var currentUser = {};
if (user != null) {
currentUser.name = user.displayName;
currentUser.email = user.email;
...