ali97
Explore posts from serversBABetter Auth
•Created by ali97 on 3/23/2025 in #help
Better Auth Session Not Loading in TanStack Router Application
I'm encountering an issue with Better Auth sessions in my TanStack Router application. The session data appears correctly in network responses, but it's not being loaded or accessible in my React components.
Project Setup:
Better Auth version: 1.1.21
TanStack Router for routing
Setup: Custom SessionProvider + Better Auth client
The Issue:
When a user logs in, I can see the correct session data in the network tab response.
However, when I try to access this data in my application, I get null. Here are my console logs:
@app/dashboard:dev: null
@app/dashboard:dev: Session in root route: missing
@app/dashboard:dev: User from route context: null
What I've Tried
Confirmed the correct session data is visible in network responses
Added debug logging throughout the fetch process
Verified that cookies are being set correctly in the browser
Confirmed Better Auth client configuration is correct
Tried using initialUser in SessionProvider and also loading in useEffect
Checked for any type mismatches between the Better Auth user data and my User interface
Questions
Why is authClient.getSession() returning null when the network request shows valid data?
Is there something wrong with how I'm integrating Better Auth with TanStack Router?
Are there any known issues with Better Auth 1.1.21 and session management?
Should I be using a different approach to handle authentication with TanStack Router?
GitHub Repository
You can see my full implementation here: [GitHub Repository Link]
Any help or insights would be greatly appreciated!4 replies
PD🧩 Plasmo Developers
•Created by ali97 on 4/9/2024 in #🔰newbie
run content script after click on element
I want to run certain content scripts after the user clicks on a an element. I read the documentation and searched through discord but could not find a working example. It would be wonderful if someone could provide a minimal working code
2 replies
KKinde
•Created by ali97 on 1/28/2024 in #💻┃support
Redirected to a page displaying null after login
I have recently migrated our startup from using clerkJs to kinde auth. I have integrated all of the parts but there seems to be an issue after login. After successfully logging in a page is shown with the message null. If I retype my website's url the authentication has indeed worked fine. I guess there is a problem with the redirect but I have set up the redirect paths as the docs suggested.
What else seems to be the problem?
5 replies