Session info isn't available fast enough on manual page reload, server sign in api needs reload
For any brave soul willing help me with this problem I posted to better-auths github I've included the info from that issue below
Using SolidStart and Postgresql
better-auth version: 1.2.7
OS: Microsoft Windows 11 HOME version: 10.0.26100 Build 26100
browser: chrome
A summary is given below. For full details go to https://github.com/Garrett-Floyd/better_auth_error and read reproduceBugInstructions.txt for a description of the current vs Expected behavior and the steps to reproduce.
Possible Bug 1: When signing up and signing in users using server api,
session info is not updated until page is manually refreshed.
This is the case even when redirecting upon (sign in/sign up).
When using client api this isn't a problem.
Possible Bug 2: On manual page reload but not using hyperlinks the session cookie isn't
always avaliable fast enough to be used in building the page.
You can usually get session info fast enough if your using it in app.tsx (the root file in solidstart apps).
However, if your using session infor in apps.tsx's props.children than the data may or may not be avaliable.
This is especially an issue when on page load you fetch via GET request to some protected route.
In my experience when this is done the session cookie is essentially never avaliable fast enough and the request is denied.
I would like to redirect to login on when an user is not signed in and they try to access a protected resource and
this bug makes that unfeasable.
GitHub
GitHub - Garrett-Floyd/better_auth_error
Contribute to Garrett-Floyd/better_auth_error development by creating an account on GitHub.
0 Replies