When filing a bug report, please confirm you've done the following:
Have you set onVerifyTokenError and onTokenRefreshError in your config and checked for any helpful errors?
Yes. (edit) -> I think the error further below was thrown by one of these functions, but not sure the error msg helps much
Have you set debug: true in your config and read through server-side and client-side debug logs for any helpful messages?
Is this in the 'init' function, or in another config? I have not done this, but if you let me know where I can do this, I will
Have you tried the example app with your own Firebase credentials?
I have tried, but couldn't install the app due to React 18 and firebase web-ui being incompatible. I then forced install to override dependency issues. Upon starting the app, it seemed like there was no way to signup users to Firebase, so I couldn't test login.
I entered wrong details and that sort of mock-logged me in, but obviously without there being a real user in Firebase, I couldn't make it work.
I am also on Next 13 instead of 12, so that may create differences?
Reading through this, I have made sure of the following:
The cookies are there and secure = false, as this is http-only localhost:
Describe the bug
This app has two types of data at the moment: Users and businesses. Users are able to add businesses.
I am able to login using NFA, can get the user profile and details and businesses. This is done by accessing the collection 'businesses' in Firestore:
When navigating away and back, or refreshing, the following error is shown:
Naturally, I checked my Firestore rules:
From what I can tell, an authenticated user should be able to access any docs. And of course it works immediately after login. It just stops working on refresh.
What is particularly odd is that when navigating away and back to the app, the user's logged-in state is remembered. As in, I am correctly re-authenticated when accessing the app again. It's just that getting 'businesses' suddenly fails. So, somehow on refresh or after navigating away and back, Firebase rejects authentication just for the collection request.
Expected behavior
I would like to be able to navigate away from my user's profile page and come back and still be able to get the user's businesses from the 'businesses' collection in my Firestore.
If auth never worked, or I got other errors, I wouldn't be opening an issue, but because it seems that auth is 'forgotten' in betwen navigations or refreshes, I wondered whether it's a bug. I'd of course much prefer if this was an issue on my side...
Debug and error logs
(edit) -> I have posted the error above, I think it is thrown by these functions:
When filing a bug report, please confirm you've done the following:
onVerifyTokenError
andonTokenRefreshError
in your config and checked for any helpful errors?Yes. (edit) -> I think the error further below was thrown by one of these functions, but not sure the error msg helps much
debug: true
in your config and read through server-side and client-side debug logs for any helpful messages?Is this in the 'init' function, or in another config? I have not done this, but if you let me know where I can do this, I will
I have tried, but couldn't install the app due to React 18 and firebase web-ui being incompatible. I then forced install to override dependency issues. Upon starting the app, it seemed like there was no way to signup users to Firebase, so I couldn't test login. I entered wrong details and that sort of mock-logged me in, but obviously without there being a real user in Firebase, I couldn't make it work. I am also on Next 13 instead of 12, so that may create differences?
Reading through this, I have made sure of the following:
Describe the bug
This app has two types of data at the moment: Users and businesses. Users are able to add businesses. I am able to login using NFA, can get the user profile and details and businesses. This is done by accessing the collection 'businesses' in Firestore:
When navigating away and back, or refreshing, the following error is shown:
Naturally, I checked my Firestore rules:
From what I can tell, an authenticated user should be able to access any docs. And of course it works immediately after login. It just stops working on refresh.
What is particularly odd is that when navigating away and back to the app, the user's logged-in state is remembered. As in, I am correctly re-authenticated when accessing the app again. It's just that getting 'businesses' suddenly fails. So, somehow on refresh or after navigating away and back, Firebase rejects authentication just for the collection request.
Versions
next-firebase-auth
version: ^1.0.0-canary.19 Firebase JS SDK: ^9.20.0 Next.js: 13.2.4To Reproduce Steps to reproduce the behavior: I wouldn't expect you to install my app, but perhaps I can show you some code:
Initialising like this:
I then try to fetch a user's businesses:
Expected behavior I would like to be able to navigate away from my user's profile page and come back and still be able to get the user's businesses from the 'businesses' collection in my Firestore. If auth never worked, or I got other errors, I wouldn't be opening an issue, but because it seems that auth is 'forgotten' in betwen navigations or refreshes, I wondered whether it's a bug. I'd of course much prefer if this was an issue on my side...
Debug and error logs (edit) -> I have posted the error above, I think it is thrown by these functions:
Additional context I have no more information :)