API calls returns Unauthorized

I have better auth setup on https://accounts.domain.com in production, for testing purposes
When I hit /api/auth/get-session on another app, running in localhost, I get 401 unauthorized.

I also have the multi domain setup like this

    crossSubDomainCookies: {
      enabled: process.env.NODE_ENV === "production",
      domain:
        (process.env.NODE_ENV === "production" &&
          ".accounts.domain.com") ||
        undefined,
    },


My BetterAuth ENV

BETTER_AUTH_SECRET=abc....
BETTER_AUTH_URL=https://accounts.domain.com


Any idea why I get 401 though am logged in on the accounts.domain.com?
Was this page helpful?