Firebase - support for the custom claims edit

Hi, I've just started working on the Retool app with Firebase resources. Unfortunately I couldn't find "Update custom claims" action type while there is no support for customClaims updating using user update method.

So the question: is there any way to somehow update claims using Retool?


Hey there, to do this I think you need to enable raw firebase queries which is in beta. We can enable it for you but since this post is on the forum, we don't know which org you belong to. Could you go into your retool instance and chat with us using the little chat helper bubble?

could you just add the firebase.auth().setCustomUserClaims() to the list of action types?

1 Like

Also could you write here step by step how to enable these raw queries? I just asked for it on chat, but unfortunately there is a info that you will be available there tomorrow.

Hi Marcin! I'd be happy to help enable the raw Firebase queries for you, with a couple caveats 😅 Feel free to write into us into so we can walk you through it!

@victoria could add to my connection Retool custom claims?

Done! :white_check_mark:

1 Like

Hey @victoria - could I also have access?

Of course @doug! Added the beta to your org :slight_smile: Let me know if you have any issues finding it (it should show up as a resource type inside of a query's resource dropdown)

Thanks @victoria - I have access and am now able to execute raw firebase admin queries.

However - I'm really struggling with getting the script to accept parameters. I have tried all of the following:

(switchApproval is an example switch component whose value I need in the query)

const isWaitlistApproved = switchApproval.value
const isWaitlistApproved = {{ switchApproval.value }}
var isWaitlistApproved; // initiate query with query.trigger({ additionalScope: { isWaitlistApproved: switchApproval.value }})

None seem to work - the first two give "Unprocessable Entity", and the last doesn't initialize the var.

FWIW, the "insert a batch" example suggested underneath the query code editor seems to suggest the first should work.

Can you advise me on how to proceed?

Hmm! The snippet you sent is from a JS query? If so, you don’t need the double curlies around component values.

And what is the name of your target query? Do you have a screenshot of that query so we can see how the target query is receiving the scope?

These raw queries are a bit of a mystery to all of us, unfortunately :sweat_smile: they’re not so much in Beta, but more so sunsetted. I just enable them for users that will be unblocked by them.

Huh, the first option started working. "Unprocessable Entity" must've been some sort of temporary outage or something. Sorry to bug you.

Oh awesome! So happy to hear that + never bugging me/us :slight_smile:

Please keep writing in!

Hey @victoria - could I also have access? Thanks!

Hey @choward232! Done :slight_smile: Hope they’re helpful for what you’re looking for!

Thank you!

Quick follow up question here: I'm having difficulty accessing certain aspects of the firebase admin sdk within the 'raw query' section.

Here is a screenshot of my code that isn't working - it seems to not import the 'getAuth' function here. The error simply shows 'bad request'. Any recommendations on how to resolve this? Thanks!

Hmm! Can you try using db.auth().getAuth() and see if that works?

Here are our docs on Firebase raw queries as well, in case they’re helpful -

Ah perfect - this resource is very helpful. It works now!

Thanks for the help here Victoria.