Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add headers to firebase httpscallable

I'd like to add an authorization header to my httpscallable for calling a firebase function. Currently I use:


const httpsCallable = Firebase.functions.httpsCallable('xxxxx');
        httpsCallable(call_args).then(....)

But I'm trying to secure my app need to add auth tokens. How can I add an authorization header with "Bearer: ...."?

The accepted answer on this thread just says "it's possible." Does anyone know how to do it though?

Thanks!

like image 763
xcodesucks123 Avatar asked Nov 30 '25 02:11

xcodesucks123


1 Answers

Answering my own question. For a logged in user, firebase will automatically include the Authorization header in the form "Authorization:" "Bearer: $token" where token is the result of firebase.auth().currentUser.getIdToken()

like image 107
xcodesucks123 Avatar answered Dec 02 '25 19:12

xcodesucks123



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!