MCPcopy
hub / github.com/nextauthjs/next-auth / getSessionAndUser

Function getSessionAndUser

packages/adapter-sequelize/src/index.ts:165–186  ·  view source on GitHub ↗
(sessionToken)

Source from the content-addressed store, hash-verified

163 return await Session.create(session)
164 },
165 async getSessionAndUser(sessionToken) {
166 await sync()
167
168 const sessionInstance = await Session.findOne({
169 where: { sessionToken },
170 })
171
172 if (!sessionInstance) {
173 return null
174 }
175
176 const userInstance = await User.findByPk(sessionInstance.userId)
177
178 if (!userInstance) {
179 return null
180 }
181
182 return {
183 session: sessionInstance?.get({ plain: true }),
184 user: userInstance?.get({ plain: true }),
185 }
186 },
187 async updateSession({ sessionToken, expires }) {
188 await sync()
189

Callers

nothing calls this directly

Calls 1

syncFunction · 0.85

Tested by

no test coverage detected