Closed nmalancea closed 1 year ago
The line you're pointing to is here in source: https://github.com/gladly-team/next-firebase-auth/blob/4e70bb70b81702a3dfc9e05baf5fc8d25b77f6df/src/useFirebaseUser.js#L46
It's called when the Firebase JS SDK triggers an ID token changed and the user is not logged in.
I'm a little confused about how you're testing staging and prod apps. Are they on separate domains or the same domain? If they're on the same domain, we'd expect the auth state to be shared between the apps. If they're on different domains, there should not be any interaction between the two apps.
Thank you, @kmjennison. That helps.
They are on completely different domains, but they share the same db & the same Firebase project (for now). It's not just a matter of stage vs prod, but also between different subdomains for individual builds generated by Vercel.
What can I do to separate the apps more in terms of auth state?
I tried prefixing the cookie name differently, e.g. instead of ExampleApp
(from the example config) changed to a different cookie name for one of the custom builds, but it was still interfering with production, if that was open in a different tab (as explained in the repro steps), resulting in the broken state.
@nmalancea My recommendation is to break out a separate Firebase project for dev/staging. I'm guessing this will solve your problem.
Closing this as likely unrelated to next-firebase-auth
, but feel free to follow up, and I'll help where I'm able.
I get into a state where I can't log in with Google when using multiple versions of my app in different browser tabs or windows.
My scenario:
The Network tab in dev tools shows a call to
api/logout
after step 6. Dev tools also show me the place in the code where it was called from. After un-minifying the file, it is line 15008, at the 2ndfetch
below.Does anyone know what may be causing this?
Versions
next-firebase-auth
version: 0.14.3 Firebase JS SDK: 8.10.1 Next.js: 12.1.6Debug and error logs No errors shown by
onVerifyTokenError
oronTokenRefreshError
.Additional context My 3rd party auth buttons:
The hook I call in my
_app.tsx
to detect 3rd party login/signup and create the internal user profile.