ankit0panchal
01/03/2024, 12:16 PMrp_st
01/03/2024, 1:23 PMankit0panchal
01/03/2024, 2:11 PMrp_st
01/03/2024, 2:12 PMankit0panchal
01/03/2024, 2:19 PMimport supertokens from "supertokens-node"
import { SessionRequest } from "supertokens-node/framework/express"
import { superTokensNextWrapper } from "supertokens-node/nextjs"
import { verifySession } from "supertokens-node/recipe/session/framework/express"
import { backendConfig } from "../../../supertokens-config/backendConfig"
supertokens.init(backendConfig())
export default async function handler(req: SessionRequest, res: any) {
await superTokensNextWrapper(
async (next) => {
await verifySession()(req, res, next)
},
req,
res
)
let userId = req.session!.getUserId()
let userInfo = await supertokens.getUser(userId)
console.log("$#userInfo $#", userInfo)
return res.status(200).json({
userInfo,
})
}
rp_st
01/03/2024, 2:27 PMankit0panchal
01/03/2024, 3:47 PMrp_st
01/03/2024, 4:11 PMankit0panchal
01/03/2024, 4:16 PMrp_st
01/03/2024, 4:17 PMankit0panchal
01/03/2024, 4:17 PMrp_st
01/03/2024, 4:17 PMankit0panchal
01/04/2024, 6:42 AMrp_st
01/04/2024, 7:43 AMankit0panchal
01/04/2024, 7:46 AMrp_st
01/04/2024, 7:47 AMrp_st
01/04/2024, 7:48 AMankit0panchal
01/04/2024, 7:51 AM