Calling authClient.signIn.social() causes unnecessary session refetch before redirect
I'm displaying a "Sign In" button in the Navbar based on whether useSession() returns a session and isPending === false. (My project is in Next.js v15.4.2 and better-auth v1.3.3
When I call authClient.signIn.social(), it immediately sends a request to the /session endpoint and flips isPending to true and then back to false even before the redirect to the provider happens. And then once again when we are redirected back to our own app.
The key here is that this whole process happens before the redirect to the provider even happens.
This results in an unnecessary session refetch and causes a UI flicker — you can make the issue clearer to notice by passing disableRedirect: true to the signIn:
onClick={() => authClient.signIn.social({ provider: 'google', disableRedirect: true })}
The whole thing around the useSession hook is problematic — session updates from the server don’t trigger any client-side re-render meaning that the session value returned from useSession remains the same, and there’s no provider to preload the initial session state on app load. I’ve already documented that issue here: https://github.com/better-auth/better-auth/issues/3608
I really liked this library when I first saw it, but trying to integrate it into real UI workflows is becoming painful. These issues are core to the developer experience and session-driven UI.
When I call authClient.signIn.social(), it immediately sends a request to the /session endpoint and flips isPending to true and then back to false even before the redirect to the provider happens. And then once again when we are redirected back to our own app.
The key here is that this whole process happens before the redirect to the provider even happens.
This results in an unnecessary session refetch and causes a UI flicker — you can make the issue clearer to notice by passing disableRedirect: true to the signIn:
onClick={() => authClient.signIn.social({ provider: 'google', disableRedirect: true })}
The whole thing around the useSession hook is problematic — session updates from the server don’t trigger any client-side re-render meaning that the session value returned from useSession remains the same, and there’s no provider to preload the initial session state on app load. I’ve already documented that issue here: https://github.com/better-auth/better-auth/issues/3608
I really liked this library when I first saw it, but trying to integrate it into real UI workflows is becoming painful. These issues are core to the developer experience and session-driven UI.

GitHub
Is this suited for github? Yes, this is suited for github To Reproduce Set up Better Auth in a Next.js app using betterAuth() with the nextCookies() plugin Enable emailAndPassword authentication Se...