Skip to content

Commit 17f396b

Browse files
committed
add firebase auth reference example
1 parent e2abf07 commit 17f396b

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

docs/ff-concepts/adding-customization/common-examples.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,4 +250,35 @@ Future addDynamicReviews(ProductStruct product, List<ReviewStruct> newReviews) {
250250
product.reviews!.addAll(newReviews); // Add the new reviews
251251
}
252252

253-
```
253+
```
254+
255+
256+
### Using Firebase Auth Variables in Custom Code
257+
258+
When using Firebase Authentication for your app, FlutterFlow provides access to key authentication data, such as `currentUserDisplayName`, `currentUserUid`, and more. These variables can be used in your Custom Actions to build additional features that require such common data from authenticated users.
259+
260+
For example, you can check if a user’s email is verified before proceeding with certain actions:
261+
262+
```js
263+
if (currentUserEmailVerified) {
264+
// Perform action for verified users
265+
}
266+
```
267+
268+
Or, if you need to create a directory path that includes the user’s unique ID:
269+
```js
270+
String directoryPath = '/users/' + currentUserUid + '/files';
271+
```
272+
273+
Here’s a list of other Firebase Auth variables that can be referenced in Custom Code:
274+
275+
- `currentUserEmail` – The email address of the current user.
276+
- `currentUserUid` – The unique ID of the current user.
277+
- `currentUserDisplayName` – The display name set by the user.
278+
- `currentUserPhoto` – The profile photo URL of the current user.
279+
- `currentPhoneNumber` – The user’s phone number, if available.
280+
- `currentJwtToken` – The current user’s JWT token for secure requests.
281+
- `currentUserEmailVerified` – Boolean indicating if the user’s email is verified.
282+
283+
- These variables make it easy to integrate Firebase Auth data into custom functionality, enhancing the user experience.
284+

0 commit comments

Comments
 (0)