Auth context
I have strange problem. I have AuthProvider in context that gets data from supabase client.
https://pastecode.io/s/frctwjra
But I get null on router context when I check if user is authenticated.
Like this:
export const Route = createFileRoute('/_authenticated')({
beforeLoad: async ({ context, location }) => {
console.log(context);4 Replies
helpful-purple•2y ago
Could you check out this repo, we troubleshooted this yesterday and got a supabase Oauth flow set up with Tanstack Router
https://github.com/dave-hawkins/tanstack-router-supabase-auth
GitHub
GitHub - dave-hawkins/tanstack-router-supabase-auth
Contribute to dave-hawkins/tanstack-router-supabase-auth development by creating an account on GitHub.
conscious-sapphireOP•2y ago
Its working now. thanks! I have one more question. Is possible to hide this redirect on refresh. 😄 you can see it on video that its fast redirect from login to dashboard
helpful-purple•2y ago
You'd have to resolve the fetch user status before the router is rendered for that to happen.
Not impossible, but that'd be some custom implementation you'd need to add.
Kind of like what was done here.
https://discord.com/channels/719702312431386674/1208044958150565958/1208369638883196928
You'd need to find its counterpart in supabase and then render the router for that to work.
conscious-sapphireOP•2y ago
Oh yes.. I see why is this happening... We can't do much i think... supabase don't have the same loading method 😦