Originally posted by **ngbrown** March 12, 2022
`isAuthenticated` and `logout` take a `Request` just to get the session. The page very well could have already gotten a session and if it is a storage based session, then it would be advantageous to not fetch from the database multiple times.
My suggestion is to change the signature like this:
```ts
async logout(
request: Request | Session,
options: { redirectTo: string }
): Promise {
const session = isSession(request)
? request
: await this._sessionStorage.getSession(request.headers.get("Cookie"));
// the rest is identical ...
}
```
`isSession` is provided by `remix`.
Discussed in https://github.com/sergiodxa/remix-auth/discussions/142