Best practices for accessing Firebase user

Building my first app, I’m able to log in successfully using firebase email/password. I’m trying to figure out how to get the details of the user after logging in. Here’s what I have for the logic of the authentication page.

However, the app variable does not get set as I would expect, it seems to be blank. I tried to debug with javascript, adding console.log(inputs), which is also blank.

I don’t know if setting an app variable is the best way to access the logged in user throughout the app. The tutorials were good at getting me to be able to log in, but I can’t figure out how to access any user data.

I think this is on the right track… my current_user only has one property right now, email, so I added this mapping from the output of the other node.

image

This does “work” to get the current_user object set as an app variable. However my original question was about best practices. Is this a good way to access user data throughout the app?

Hi, using an app variable that is populated from the outputs of the “Get current user” node is a good way to store user information in the app, so you’re on the right track.

You don’t need to use the mapping binding type though, you can use “object with properties” binding with “Output value of another node” or a direct formula binding, such as {email: outputs["Get current user (Firebase Auth)"].user.email}