getSession(req, res, options)
#
Parameters- Express
- Hapi
- Fastify
- Koa
- Loopback
- AWS Lambda / Netlify
- Next.js
- NestJS
req
- type:
Express.Request
- type:
res
- type:
Express.Response
- type:
options
(Optional)- type:
{antiCsrfCheck?: boolean, sessionRequired?: boolean}
- type:
req
- type:
Hapi.Request
- type:
res
- type:
Hapi.ResponseToolkit
- type:
options
(Optional)- type:
{antiCsrfCheck?: boolean, sessionRequired?: boolean}
- type:
req
- type:
Fastify.FastifyRequest
- type:
res
- type:
Fastify.FastifyReply
- type:
options
(Optional)- type:
{antiCsrfCheck?: boolean, sessionRequired?: boolean}
- type:
req
- type:
AWS.APIGatewayProxyEvent | AWS.APIGatewayProxyEventV2
- type:
res
- type:
AWS.APIGatewayProxyEvent | AWS.APIGatewayProxyEventV2
- type:
options
(Optional)- type:
{antiCsrfCheck?: boolean, sessionRequired?: boolean}
- type:
req
- type:
Koa.Context
- type:
res
- type:
Koa.Context
- type:
options
(Optional)- type:
{antiCsrfCheck?: boolean, sessionRequired?: boolean}
- type:
req
- type:
Loopback.MiddlewareContext
- type:
res
- type:
Loopback.MiddlewareContext
- type:
options
(Optional)- type:
{antiCsrfCheck?: boolean, sessionRequired?: boolean}
- type:
req
- type:
Next.NextApiRequest
- type:
res
- type:
Next.NextApiResponse
- type:
options
(Optional)- type:
{antiCsrfCheck?: boolean, sessionRequired?: boolean}
- type:
NestJS uses library-specific types for Request and Response. You should use the one provided by your underlying framework (the default is Express)
req
- type:
Express.Request
- type:
res
- type:
Express.Response
- type:
options
(Optional)- type:
{antiCsrfCheck?: boolean, sessionRequired?: boolean}
- type:
#
ReturnsPromise<Session>
#
Throws- If the session does not exist and
sessionRequired
is notfalse
- If the access token has expired, we need to try the refresh token.