Firebase Auth (Current User)
Last updated
Last updated
The Firebase Auth element was created to work as a substitute to Bubble's "Current User" value. So you can use to retrieve data and the authentication state from the user logged in through Firebase.
Here you must specify the id (or name) of the collection of document in Firestore where you chose to store user data. The plugin will fetch data from the document in that collection that has the same ID as the current authenticated user.
The names of the fields on the user's collection that you which to fetch from the document an use on Bubble.
For each field you choose to fetch from the document, you must specify the type of data Bubble should try to receive.
In some cases, more than one type can be applied, like in boolean values, that you can get as "text" or "yes/no". In other cases you must be careful to declare the right value, or error can occur, like when you try to declare a "number" for a "text" value.
The Auth element provides information on the authenticated user. Some are directly linked to the user, but some can be stored on the user's collection at Firestore.
If the user is logged out, those states will be empty, so that is one the ways you can identify if the user is logged in (e.g. Auth's user ID is not empty).
The ID of the authenticated user, that is also the ID of the same user's document on the users collection at Firestore.
The email associated to the user's account. It can be empty if the user was created with SMS/phone login through another service, like FlutterFlow, for instance.
The URL to the profile picture of the user.
The user's display name associated with the account.
The fields of the user's collection on Firestore, that you chose to retrieve when you specified them on the Auth element settings.
This state provides the whole JSON string of the document.
The type of authentication of the current user.
Can be password, google, facebook or github.
Indicates if the current user has verified his/her account's email.
The date and time when the user has signed up.
The date and time when the user last logged in to the app.
The current user's access token, that can be used to make authenticated calls to REST APIs.
The current user's refresh token, that can be used to acquire new access tokens.
Turns to "yes" when all the element's states are done being filled, an "no" when they are being filled.
Although this operations are fast, the fact the they are filled in order and not at the same time may lead to issues, that's why this state was created.
This action will reload the elements data, which can be useful if, for any reason when you updated the user's credentials the profile information contained in the Auth Element is not refreshed automatically.
The Auth element implement a function in the page that listens to any changes on the user's authentication state. This changes will trigger two different kinds of events that can initiate Bubble workflows: "User is logged in" and "User is logged out".
Triggered when the authentication state of the user is changed and the user is logged in.
Triggered when the authentication state of the user is changed and the user is logged out or null. This you also be triggered when a user's account is deleted.
Important! If you use the "User is logged in" and "User is logged out" events to redirect users to another page, while creating an account, it is possible the the events will trigger before the write operations of firestore are completed during sign up. Because of that, it is suggested to use the "Firebase Action Listener" "User signed up" event for this case instead.
Triggered when the user data is done loading from the authentication service and from Firestore.
This might be useful if you want to use a do get more fields from the user and the current element didn't have enough slots to do so. It can also be useful to provide document data to a popup filter, reusable element, et cetera, without the need to query the user's document again from Firestore.