I connected successfully, refreshed the page, and the userInfo output was wrong

package.json
@web3auth/modal”: “^10.0.5”,
web3-auth-provider.tsx
`“use client”;
import {
Web3AuthProvider as Provider,
type Web3AuthContextConfig,
} from “@web3auth/modal/react”;
import {
cookieToWeb3AuthState,
WEB3AUTH_NETWORK,
} from “@web3auth/modal”;
import { WagmiProvider } from “@web3auth/modal/react/wagmi”;
import { QueryClient, QueryClientProvider } from “@tanstack/react-query”;
import React from “react”;

export const clientId = process.env.NEXT_PUBLIC_WEB3_AUTH_CLIENT_ID;

if (!clientId) {
throw new Error(“client Id is not defined”);
}
const queryClient = new QueryClient();

const web3AuthContextConfig: Web3AuthContextConfig = {
web3AuthOptions: {
clientId,
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_DEVNET,
ssr: true,
},
};

export default function Web3AuthProvider({
children,
cookies,
}: {
children: React.ReactNode;
cookies: string | null;
}) {
const web3authInitialState = cookieToWeb3AuthState(cookies);

return (


{children}


);
}
`

connect-demo.tsx  
`"use client";
import { useWeb3AuthConnect, useWeb3AuthUser } from "@web3auth/modal/react";
import { Button } from "@workspace/ui/components/button";
import { memo } from "react";
// import { Loader2Icon } from "lucide-react";

export const ConnectDemo = memo(() => {
  // console.log("LoginForm")
  const { connect, isConnected } = useWeb3AuthConnect();
  const { userInfo, loading } = useWeb3AuthUser();
  console.log(
    "userInfo",
    userInfo,
    "userInfo loading",
    loading,
    "isConnected",
    isConnected,
  );
  return (
    <div className="flex h-full w-full flex-col items-stretch justify-center md:max-w-[416px]">
      <div className="flex flex-col items-center justify-center gap-3 py-6">
        <div className="flex items-center justify-center">
          <div className="text-card-foreground justify-start text-2xl font-semibold leading-normal">
            Welcome to OpenSci Lab
          </div>
        </div>
        <div className="flex items-center justify-center self-stretch">
          <div className="text-muted-foreground flex-1 justify-start text-center font-['Inter'] text-sm font-normal leading-tight">
            Login with new account to sign up
          </div>
        </div>
      </div>
      <div className="flex w-full items-center justify-center">
        <Button
          className="w-full"
          onClick={() => {
            // connect();
          }}
        >
          {/* {isPending && <Loader2Icon className="animate-spin" />} */}
          Sign In
        </Button>
      </div>
    </div>
  );
});
`
The console keeps giving warnings
![image|690x118](upload://ti56Cmsf26fc1VkZPiZ9cDZDIQd.png)

Thanks for the detailed report! Here’s a summary of your issue and what the support team will need to investigate further:


Issue Summary

  • SDK & Version:
    • @web3auth/modal v10.0.5
    • Using the Plug n Play (PnP) Modal SDK with React (Next.js)
  • Platform:
    • React / Next.js (using SSR)
  • Problem:
    • After a successful connection, refreshing the page causes the userInfo output to be incorrect or not as expected.
    • Console warnings are present (see attached image).

Provided Details

  • Initialization & Login Code:
    • You shared your Web3AuthProvider and ConnectDemo components, showing usage of SSR and cookie-based state restoration.
  • Console Warnings:
    • Screenshot provided (though the image link is broken in this text, please ensure it’s uploaded/visible for the team).
  • Environment:
    • Using WEB3AUTH_NETWORK.SAPPHIRE_DEVNET
    • SSR enabled in the Web3Auth config
    • Using Wagmi and React Query

Next Steps / Suggestions

  1. Check SSR Cookie Handling:
    Since you’re using SSR and restoring state from cookies, ensure that the cookies are being set and read correctly on both server and client sides. If the cookie is missing or malformed after refresh, the state restoration could fail.

  2. Verify cookieToWeb3AuthState:
    Double-check that the cookie passed to cookieToWeb3AuthState contains the expected Web3Auth state after login and after a page refresh.

  3. Console Warning Details:
    If possible, please provide the full text of the console warning/error (as the screenshot is not directly viewable here), as it may help pinpoint the issue.

  4. Reference Docs:


Additional Information Needed (if not already provided)

  • Are you seeing the issue with all login methods or just specific ones?
  • Does the issue persist if you disable SSR (set ssr: false) as a test?
  • Is the userInfo object empty, partially filled, or containing incorrect data after refresh?

Let us know if you can provide the full console warning/error text and clarify the above points. This will help the support team reproduce and resolve your issue faster!

Thank you for your detailed report and for using Web3Auth!

Note: This response was generated by an AI bot and may require further verification. The Web3Auth support team has tracked this issue and will be responding as soon as possible.

Additionally, we would recommend you to join our biweekly Office Hours to get this resolved even faster. Web3Auth Developer Office Hours

Can you please share a recording using https://jam.dev?