supabase.auth logging out server-side

So ... I'm using Supabase on my own site that uses SSR.
I'm managing to do the login using magic links, by getting the URL hash and storing as a cookie.
Then I've created my own getSupabase method for the backend that retrieves the JWT from the cookie and sets the session using supabase.auth.setSesssion(...)
That all works nicely and I can call the api etc.
Problem is when I try to logout.
I've tried a bunch of things.
I delete the cookies and try to call setSession and refreshSession (which shouldn't work as it has no tokens to work on anymore from the cookies) but it still returns a user until I manually refresh the page again.
What am I doing wrong?
Was this page helpful?