In NextJS, client-side, you cannot distinguish between not-yet authenticated and unauthenticated.
Client-side, you are using the current user and token hooks populated by FiefAuthProvider. Problem is, on page load, you get null values, that will either get populated with the user info when the request to /current-user resolves and fills in the context, or simply never be changed if the user is unauthenticated.
That causes issues as we use fief to authenticate our external api calls, and is inelegant for showing user information (Flashes log in before showing user info, instead of a loading state).
The solution I propose is simple, but can be discussed of course : have the context provide an initial value to indicate loading, and only go null when we know user is unauthenticated.
Related to :
https://github.com/orgs/fief-dev/discussions/292
Steps to reproduce the behavior:
An authenticated user first loading the page should be distinguishable from an unauthenticated user.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too