DEV Community

Discussion on: @nuxtjs/firebase social auth

Collapse
 
madhusudanbabar profile image
Krypton | Madhusudan Babar

Hey, i tried this, actually I've used this module before too but my problem is that when I'm trying to display the currentUser in the navbar, it actually displays after few seconds and i want to fetch the user details on server side, can you please help me with this!?

I can share the code if you wish,

Thanks 😊

Collapse
 
rodrigopv profile image
Rodrigo Peña

Hi,

Without analyzing too much the situation, sounds like you might want to add a loading screen before displaying the whole layout (so you don't show components where data is not available yet).

This tutorial allow you to have the user data on server side, but won't allow you to do authentified calls to firebase (such as retrieving firestore documents on behalf of the user).

That pattern is still being developed I think as Firebase has certain limitations when it comes to using it on SSR in the same way the browser does it (imagine the server doing many calls to firebase with different users tokens from the same IP, would look like suspicious activity).

What it makes sense to me is that vuex should be hydrated using Firebase Admin API on server-side instead of using the end user methods.

What I've read until now is that server should only know logged in user data (like this tutorial shows) to do basic routing decisions (such as sending the user to log in or show them the user profile view), and all the rest should be done on client-side as firebase is designed for.

Let me know if this make sense to you!