getSession is not returning userAgent

I've been trying to set up a multisession feature so users can revoke access on other devices session. But getSession it not returning userAgent nor ipAddress. I even followed the Better Auth report example.
Solution
Yeah, I create a server action and passed the headers when calling the function.
export const getSessionData = async () => {
  try {
    const headersList = await headers();

    const [session, activeSessions] = await Promise.all([
      auth.api.getSession({ headers: headersList }),
      auth.api.listSessions({ headers: headersList }),
    ]);

    return {
      session,
      activeSessions,
      isAuthenticated: !!session,
    };
  } catch (error) {
    console.error("Error in getSessionData:", error);
    return {
      session: null,
      activeSessions: [],
      isAuthenticated: false,
    };
  }
};
Was this page helpful?