How to use httpsCallable on SSR page and pass user auth info to Cloud Function? #1484
Replies: 1 comment 1 reply
-
Solved |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Why am I getting a
request.auth
isundefined
in thisonCall
function?I am using Firebase Function emulator for this test.
I am trying to call a Firebase function directly from my app like so:
/functions/getStory.js
:The above function, when invoked, responds with the following:
Here is the client side code that invokes the cloud function:
/pages/test-oncall.vue
:The browser log for the above client code is:
Notice that the
request.auth
isundefined
at an initiallog
point ("message":"request.auth from client: undefined"}
, but then later resolves correctly. Why does this happen? It's like auth is not initialized yet until a later time. If that's the case, how do I properly checkrequest.auth
so I can do some authentication on the server to determine if the user is eligible to receive confidential data from Firestore when using theonCall
method?Beta Was this translation helpful? Give feedback.
All reactions