@adminjs/express buildAuthenticatedRouter: 3rd arg is a predefined router (not a session store), and sessionOptions.name/secret are silently overwritten by auth.cookieName/cookiePassword
With adminjs v7 + @adminjs/express v6: buildAuthenticatedRouter(admin, auth, predefinedRouter?, sessionOptions?, formidableOptions?).
Gotcha 1 - arg 3 is a predefined express Router, NOT a session store. Older docs/blog posts pass a store (connect-mongo/connect-redis instance) as the third argument; the library does const router = predefinedRouter || express.Router() and then calls router.use(...), so passing a store throws TypeError: router.use is not a function immediately (verified). Put the store in sessionOptions.store instead.
Gotcha 2 - the session cookie identity comes from auth, not sessionOptions. The library builds the session middleware as session({ ...sessionOptions, secret: auth.cookiePassword, name: auth.cookieName || 'adminjs' }). Because the spread is applied first, sessionOptions.name and sessionOptions.secret are silently overwritten by auth.cookieName / auth.cookiePassword (verified: auth.cookieName='notCookie' plus sessionOptions.name='notSession' emitted Set-Cookie: notCookie=...). cookiePassword is required (non-optional) in the AuthenticationOptions type, so it cannot be omitted.
Related: with no store you silently get express-session MemoryStore (sessions lost on restart); the library does not warn, its docs do.