How to revalidate session from the server side?

Hi,
I'm using
useSession()
hook on the client to show the state on the auth.
When an unauthenticated visitor makes some action, I firstly sign them in to get anonymous user id, like that:
const anonSession = await auth.api.signInAnonymous({ headers })

and redirect the anonymous user back to the page.
The problem is that the useSession still shows the unauthenticated state until I refresh the page.

Is there any way to revalidate the session from the server?

Tried await authClient.getSession({ query: { disableCookieCache: true } }) but it doesn't work.

Please help!
Was this page helpful?