3

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!

xcodesucks123
  • 424
  • 4
  • 8

1 Answers1

2

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()

xcodesucks123
  • 424
  • 4
  • 8
  • I'm not seeing this, do you have any links you can share on it? I am using flutter, flutterfire, cloud functions, and python. I returned request.authorization from the cloud function just to see, and it comes up as "None". So I'm not sure why, but in flutter my call seems to not include the Authorization header. – Eradicatore Apr 09 '21 at 18:23