Firebase auth on the server #1329
Unanswered
mitjans
asked this question in
Questions and Help
Replies: 2 comments 1 reply
-
Supabase currently provides the mothod serverSupabaseUser that can be used in server endpoints. Is this planned for Vuefire as well? |
Beta Was this translation helpful? Give feedback.
0 replies
-
I think you are mixing up two things. 1) The server side rendered (Nuxt) pages and 2) server routes (which uses the unjs/h3 http framework). VueFire is available in SSR part of Nuxt, but not available in server routes. You should use the Firebase Admin SDK for Firebase in server routes. |
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
-
The Vuefire documentation states:
I've tried to access
getCurrentUser()
on the server using Nuxt (/server/api/endpoint.ts
), but the call to this function never returns and the server hangs.I've been reading about SSR and firebase authentication on other frameworks, blog posts and videos. It seems that if you want to authenticate the user on the server, you need to send an id token from the client and handle session cookies with Firebase admin SDK.
Use case: I want to access and modify a user's Firestore data from server side after a call to an API endpoint.
Is the handling of Auth server side the only way? Why is
getCurrentUser()
failing to return anything and hanging up the server entirely? Any plans on adding documentation on how to handle Auth in SSR and Nuxt?Thanks!
Beta Was this translation helpful? Give feedback.
All reactions