lil_splif
11/28/2023, 8:53 PMSession.init({
override: {
functions: (originalImplementation) => {
return {
...originalImplementation,
createNewSession: async function (input) {
let userId = input.userId;
try {
let userInfo = await supertokens.getUser(userId);
console.log(userInfo)
// This goes in the access token, and is availble to read on the frontend.
input.accessTokenPayload = {
...input.accessTokenPayload,
email: userInfo.emails[0]
};
} catch (err) {
console.log({ err });
}
return originalImplementation.createNewSession(input);
},
};
},
},
}),