https://supertokens.com/ logo
#support-questions
Title
# support-questions
r

rp

04/26/2021, 4:59 AM
You should change it to the following please:
Copy code
const createSession = async (res, userId) => {
    try {
        console.log(userId)
        let session = await Session
            .createNewSession(res, userId);
        console.log(session);
    } catch (error) {
        console.log(error);
        throw error
    }
}
Copy code
const signIn = (req, res) => {
    const { email, password } = req.body
        ThirdPartyEmailPassword
            .signIn(email, password)
            .then(async u => {
                try {
                  await createSession(res, u.id)
                  res.json(u)
                } catch (err) {
                  res.status(500).json(e.message)
                }
            }).catch(error => {
              res.status(500).json(error)
            })
}