https://supertokens.com/ logo
Title
m

mukulg22

01/05/2023, 1:03 PM
Hey team, Im trying to wrap custom attributes to the jwt priovided by supertokens. Im using Node (backend) and angular js (frontend). I went through the docs, but not sure as to where I will be calling the '/updateinfo' endpoint mentioned in the docs -> https://supertokens.com/docs/passwordless/common-customizations/sessions/with-jwt/custom-claims#method-1-after-session-verification. Please clarify.
r

rp

01/05/2023, 1:18 PM
Hey @mukulg22
If you want to add custom attributes during session creation, you can do that by overriding the createNewSession function
As shown in the first part of the link above
m

mukulg22

01/06/2023, 4:31 AM
Hey @rp, in the example I see that the role set is static value in createNewSession method. How do I pass dynamic values in this case?
r

rp

01/06/2023, 4:58 AM
you can write your own code in the function to get any attribute dynamically. It's just a regular function
m

mukulg22

01/06/2023, 6:46 AM
meanwhile, how do I get the user email in this method? I dont find it in the accessToken @rp
r

rp

01/06/2023, 6:46 AM
you can get the user ID and then get the user info from the recipe function (i think there should be a getUserById function), and then add that into the access token payload