how to capture and store a user's UID from a Firebase Authentication response in Retool, and how to subsequently use it in queries within the Retool application.

I am currently implementing custom authentication with Firebase in my Retool application. After a successful login, I need to capture the user's UID from the Firebase Authentication response and store it for use in subsequent queries within Retool.

I have set up Firebase as a custom authentication resource and am successfully logging in users. My challenge now is how to correctly capture the UID returned from Firebase after login and store it in a global variable or temporary state, such as currentUserId. This UID is crucial for me to use in the body of other queries to interact with my Firebase database, where I need to reference the UID in document paths.

Custom API authentication