Skip to main content
← Data, API & Backend
Data, API & Backend October 12, 2021 · 19 replies

Using Bravo's user.id - where is it?

Archived from the Bravo community forum (2021–2026). Some answers may refer to older versions of Bravo.

In the details for the Notes app, Bravo says:

"After the user has logged in, two special Bravo variables will be created: user.id and user.email. These variables can be sent as part of an API request, to store user-specific data in the database. "

I'm thinking that the user.id identifier would be extremely useful as the ID in an Airtable Database, or showing in the database to help sort records.

At the moment if I log into my app, every record shows, and the other Bravo tutorial I saw about using a filter doesn't work - add a filter and I get an error and a blank screen.

Anyone have any tips? 🙂

19 replies

app.monster October 12, 2021

Hey Paul,
yes you can use the user.id in your POST request to add it as ID to your Airtable. What filter are you currently using?

Paul October 12, 2021

I used the  ?filterByFormula={userid}='${user.id}' filter in this tutorial:

https://docs.bravostudio.app/resources/app-cases/build-a-notes-app-with-user-id-and-email-from-firebase

Without the filters, my GET and POST requests work fine.  How do you create a POST request without a field on screen?  Or is it that I haven't probably setup the login page to send the information to airtable?

Actually, I wonder if that's it?  After log in, Airtable needs the ID, and at the moment, the log in doesn't communicate that...?

Kevin October 12, 2021

The user.id is the ID coming from firebase if you are using firebase as user database. So you need to map this external id in your airtable rows if you want to filter on it. Hope that helps

Paul October 12, 2021

Thanks... so... how do I do this?  How do you POST the $user.id from Firebase to Airtable?  I think that's the bit I'm a bit confused with.

Paul October 12, 2021

So, I have a submission form within in the app, and without submitting that form, the app isn't much use.  So I could have the user.id sent to Airbase through the submit on that page... but I'm unsure as to how I'd achieve that as it wouldn't need a user editable input field.  🙂

Kevin October 12, 2021

I haven't done it yet but I plan to do it like this for my own app (I have the same kind of behavior, I need to authenticate user with firebase for example and then fill data about my user in another database.

I think you can use solution like zapier or integromet to automate some work, or, at least to test your workflow, just add to your airtable database a new property column with firebase id, and just copy paste from firebase the IDs you want to test and develop.

If you want to automate, im pretty sure you can do it with a custom scenarion in integromat like "when a new user account is created in firebase, add a new row to that airtable database with that id in column firebase ID". You can do magic with integromat

app.monster October 12, 2021

When you read through the article you sent you will find this request body for the POST request:  

{

"records":[

{

"fields":{

"note":"${noteContent}",

"userid":"${user.id}"    <-- This is the line probably missing in your post request. It populates the "userid" field directly with the value from firebase (no Zapier etc needed)

}}]} 
Have a look at this section again: https://docs.bravostudio.app/resources/app-cases/build-a-notes-app-with-user-id-and-email-from-firebase#post-add-note

Paul October 12, 2021

Thanks guys.

app.monster - that line is definitely in the body of my JSON code. 🙂

I've been making sure all my JSON requests were the correct $attributes rather than for just one thing.

Paul October 12, 2021

Let's look at it a different way.  If I look in Firebase, Firebase creates a "UID".

Is that UID the same number that should be the user.id in Bravo?  Just to try and get my head around it... 🙂

Kevin October 12, 2021

Yes that's what you are supposed to see in bravo variable, the uuid coming from the related user in firebase

Paul October 12, 2021

Now I'm getting  a 409 conflict on my POST when trying to select all.

Paul October 12, 2021

Not getting the conflict anymore, but the Input form won't send in Bravo Vision, although it does work using the SEND button on the API setup.

Alex July 13, 2022

I'm at this same spot! Ironically mine used to work and then broke

app.monster July 13, 2022

There can be a couple of reasons why it might break. You say the request is still working inside of the API setup?

Alex July 13, 2022

Thanks I just DM'd you a LOOM of my issue (would post here but I think my key is visible)

Your Question:

  • What works: Yes the Post request works in both Xano & Bravo Studio. Posts correctly and I see the data in the Database.
  • Issue: In Bravo Vision (on my phone) I just get the error message when trying to post. Strange because nothing changed on my end. Just took a month off and came back to it broken.
app.monster July 14, 2022

Hey Alex,
just watched the loom video. My first guess was that it had to d with the limitations of Xano's free plan, but I can't really say. The next thing could be the binding. The way I would start debugging would be by rebuilding the full request and then try binding it again with the new variables (this time only the necessary). And maybe even do a sanity check and put the form outside a modal but I really don't think that that's it.

Alex July 14, 2022

Thanks! Yeah those are good guesses, I did take your advice and try rebuilding and rebinding, but it ended up working today for no reason - turns out it was a bug on the Bravo side 🤷🏻‍♂️

"Hey, we are happy to hear it! Actually we released a fix that was related to this :)"

Wrote something in this thread and want it removed? Request removal

Still stuck?

Ask the community on Discord

This archive is read-only. New questions, office hours and product updates now happen in the Bravo Discord.

Join the Discord