https://supertokens.com/ logo
Title
n

Noodles

12/27/2022, 9:16 AM
Is there any equivalent to signUpFeature for signin? I'm trying to add a token form field for my CAPTCHA token, and this works fine for signup as I've added the validator in the backend override, but how do I do the same for signin?
r

rp

12/27/2022, 9:17 AM
Hey @Noodles
You can’t modify the formField for sign in at the moment. But you can use the preApiHook to modify the request body and add the token to that
And then read that token from the request body in the backend
n

Noodles

12/27/2022, 9:27 AM
Okay cool, considering that a new captcha token is generated on the frontend with every render, how can I pass the token along to the preApiHook to then be passed to the backend?
r

rp

12/27/2022, 10:21 AM
which frontend SDK are you using?
n

Noodles

12/27/2022, 11:02 AM
Web JS
r

rp

12/27/2022, 11:04 AM
the same style is applicable for other recipe functions as well
n

Noodles

12/27/2022, 11:08 AM
Oh I see. Alright, so let’s say my token is generated within login.tsx, how would I pass that same token to my frontend.ts file (where my frontend configuration is located), sorry if these are dumb-sounding questions, just trying to grasp a deeper understanding of this
r

rp

12/27/2022, 11:11 AM
where are you calling the supertokens web-js function? In login.tsx or in frontend.ts?
n

Noodles

12/27/2022, 11:16 AM
I'm calling signIn from login.tsx, but supertokens is initialized in frontend.ts
r

rp

12/27/2022, 11:20 AM
right. So you can add the preAPIHook to the sign in function itself
see the link above
it's calling createCode and to that function its giving the pre API hook. You can do a similar thing for the sign in function call too
n

Noodles

12/27/2022, 11:23 AM
Oh I see! That's helpful
Thank you for clarifying