Auth session not persisting in Js/sdk

Hey,
I noticed I am loosing the session when I refresh the page. Again I have to create a seesion to use the sdk.
Is there anyway to persist the session or am I doing anything wrong?

const client = new AmityClient({
  apiKey: apiKey,
  apiRegion: ApiRegion.US,
});

export const checkAmityConnection = async () => {
  if (client.connectionStatus === ConnectionStatus.Connected) return true;
  else {
    try {
      let response = await registerToAmity();
      if (response === ConnectionStatus.Connected) return true;
    } catch (error) {
     // error
    }
  }
};

const getAuthToken = async () => {
    API to receive Amity auth token from backend
};

const sessionHandler = {
  async sessionWillRenewAccessToken(renewal) {
    try {
      const updatedAuthToken = await getAuthToken(userId);

      renewal.renewWithAuthToken(updatedAuthToken);
    } catch (error) {
      renewal.unableToRetrieveAuthToken();
    }
  },
};

export const registerToAmity = async () => {
  try {
    let authToken = await getAuthToken();

    await client.registerSession({
      userId: userId,
      displayName: userName,
      authToken,
      sessionHandler,
    });

    let response = await new Promise((resolve) => {
      client.on("connectionStatusChanged", ({ newValue }) => {
        if (newValue === ConnectionStatus.Connected) {
          resolve(newValue);
        }
      });
    })

    return response;
  } catch (error) {
    return new Error(error);
  }
};

Now if I refresh the page and call any Amity classes without checkAmityConnection this function. Nothing works. I have to call this function everytime I refresh the page.

Hi, let us review your code and will get back to you, thank you.

Hello, our team has confirmed that this approach is in line with the design. The recommended solution is to store the user ID in local storage and setting up an automatic login when you refresh the page.