rp
03/17/2021, 3:42 PMrp
03/17/2021, 3:43 PMbachras
03/17/2021, 3:55 PMdeltasoneca
03/19/2021, 12:37 PMgetServerSideProps()
. It is not advised to use fetch()
there as the template does in the client side. So what should I do?
I was able to make it work using the code below, but I am not sure it's the best way to do it -- I just adapted the code present in the template.
Also this does not return the email used for login (I am not using social login). I need the email.
await superTokensNextWrapper(
async next => {
return await verifySession()(context.req, context.res, next);
},
context.req,
context.res
);
const { userId } = await context.req.session;
Any help is appreciated! Thanks!Adiboi
03/19/2021, 1:29 PMkakashi_44
03/19/2021, 2:01 PMothiagocruz
03/19/2021, 2:21 PMkakashi_44
03/19/2021, 2:44 PMothiagocruz
03/19/2021, 2:45 PMothiagocruz
03/19/2021, 2:45 PMdeltasoneca
03/19/2021, 3:39 PMreq.session.sessionData
was empty (I expected the email to be there), but getUserById
should do the trick, tks!theefunklord
03/19/2021, 3:46 PMrp
03/19/2021, 5:03 PMrp
03/19/2021, 5:03 PMothiagocruz
03/19/2021, 5:05 PMtheefunklord
03/19/2021, 5:05 PMrp
03/19/2021, 5:06 PMrp
03/19/2021, 5:08 PMSession.verifySession()
function in your APIs.othiagocruz
03/19/2021, 5:09 PMrp
03/19/2021, 5:09 PMothiagocruz
03/19/2021, 5:10 PMrp
03/19/2021, 5:10 PMrp
03/19/2021, 5:10 PMothiagocruz
03/19/2021, 5:11 PMothiagocruz
03/19/2021, 5:11 PMrp
03/19/2021, 5:11 PMgetAllSessionHandlesForUser
. If this returns an array of size > 0, then they are logged in into at least one device.othiagocruz
03/19/2021, 5:11 PMothiagocruz
03/19/2021, 5:11 PM