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

prachi

03/09/2022, 4:03 AM
How to pass emailid in user context in passwordless login? when I pass emailid - it comes empty curl 'http://localhost:3002/auth/signinup/code/consume' \ -H 'Connection: keep-alive' \ -H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="98", "Google Chrome";v="98"' \ -H 'fdi-version: 1.8,1.9,1.10,1.11,1.12' \ -H 'Content-Type: application/json' \ -H 'rid: passwordless' \ -H 'sec-ch-ua-mobile: ?0' \ -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.109 Safari/537.36' \ -H 'sec-ch-ua-platform: "macOS"' \ -H 'Accept: */*' \ -H 'Origin: http://localhost:3000' \ -H 'Sec-Fetch-Site: same-site' \ -H 'Sec-Fetch-Mode: cors' \ -H 'Sec-Fetch-Dest: empty' \ -H 'Referer: http://localhost:3000/' \ -H 'Accept-Language: en-GB,en;q=0.9' \ -H 'Cookie: sIRTFrontend=remove' \ --data-raw '{"userInputCode":"802331","deviceId":"urowSmkumH6t5DI/VMayKmM2sHmJdmjbAda6X/+2f3c=","preAuthSessionId":"PzcQXtL9_yC9bPrQCb68Ys5vCRPQQIwJG7YEdnkMnm8=","userContext":{"email":"prachi@xyz.com"}}' \ --compressed
r

rp

03/09/2022, 4:24 AM
Hey! I don’t think I understand your question. Can you please elaborate?
p

prachi

03/09/2022, 5:37 AM
sure, I want to know how to pass custom parameter in this api and access it in node sdk?
r

rp

03/09/2022, 5:48 AM
You can override the consume code API on the backend and get access to the request object to then read the custom param.
And in the function you provide, you can read the request object via
input.options.req.original
. That is the underlying express request object.
p

prachi

03/15/2022, 6:34 AM
Thank you. I have overriden the API, and while passing email I am getting it in input.options.req.original.body.... but in the overriden function implementation of passwordless still email id is not present in input.
@User
r

rp

03/15/2022, 6:34 AM
Can you tell me which function(s) you are referring to exaclty?
p

prachi

03/15/2022, 6:41 AM
In this I have overriden API to capture email, but in the function overriden call still no email is there in the input. This is my doubt.
r

rp

03/15/2022, 6:46 AM
Does
req.body
have the email field that you want
?
If it does, what do you want to do with the email field? Consume it in some other function? If yes, which function?
p

prachi

03/15/2022, 6:47 AM
yes
r

rp

03/15/2022, 6:48 AM
Which function do you want to consume th email field in?
p

prachi

03/15/2022, 7:14 AM
I want to consume the email field in passwordless(originalImpl)
while creating the new user , I want that field.
r

rp

03/15/2022, 7:16 AM
I see. So you can use the user context feature we have for this: https://supertokens.com/docs/passwordless/advanced-customizations/user-context
This will enable you to pass the custom email field from one function to another.
p

prachi

03/15/2022, 7:26 AM
thank you
r

rp

03/15/2022, 7:26 AM
you're welcome.
3 Views