Hello, I want to add the user email to the session...
# support-questions-legacy
y
Hello, I want to add the user email to the session context that is sent to my frontend. I read that thread that advise to use createNewSession override & add the email to the access token payload https://discord.com/channels/603466164219281420/1108319271337074809 So I did
Copy code
Session.init({
  override: {
    functions: originalImplementation => {
      return {
        ...originalImplementation,
        createNewSession: async input => {
        const email = 'test@test.com';
              input.accessTokenPayload.email = email;
                  return originalImplementation.createNewSession(input);
                },
              };
            },
          },
        }),
  },
Then on my frontend :
Copy code
const session = useSessionContext();
console.log('sessionContext', session);
This works when the user first logs in ("test@test.com" is present in the payload), but then when my app makes other requests, it disappears from the payload (see screenshot). I'm having trouble to understand why. Does supertokens make updates to the payload during calls on my app ? Is there another function that I need to override ?
11 Views