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

solminded

05/11/2022, 1:58 PM
Hi again, I am trying to get password reset email open a deep link in my react native app. So I am posting user password request via
/api/auth/user/password/reset/token
and at the backend I get
user
and
passwordResetURLWithToken
params and I can customize the email, so far so good. What I would like to do here is pass additional info to backend
createAndSendCustomEmail
method so that I can generate deep links according to users OS etc and send the email correctly. If I pass additional info in the
formFields
obj I get the 'Are you sending too many / too few formFields ' 400 error. I would appreciate any pointers. Thanks.
r

rp

05/11/2022, 1:58 PM
hey @solminded
So you can read the OS from the request header in the API that generates the token, and pass that info to the
createAndSendCustomEmail
via the user context object.
It would be great if you could ask this question via stack overflow. If not, that's cool too. Lmk if you need more details like code snippets etc..
s

solminded

05/11/2022, 4:30 PM
Hmm ok I was thinking about adding custom fields to the reset password formFields similar to here: https://supertokens.com/docs/thirdpartyemailpassword/common-customizations/signup-form/adding-fields
r

rp

05/11/2022, 4:31 PM
these extra form fields only apply to the sign up page
not the reset password page
s

solminded

05/11/2022, 6:07 PM
ok thanks, I think I will create some custom endpoints and use
ThirdPartyEmailPassword.createEmailVerificationToken
directly instead of using
/api/auth/user/password/reset/token
from the API.
r

rp

05/11/2022, 6:12 PM
That would work too (you should use ThirdPartyEmailPassword.createResetPasswordToken). But what I suggested originally, why would that not solve your use case?
s

solminded

05/11/2022, 6:20 PM
Yeah,
ThirdPartyEmailPassword.createResetPasswordToken
is the correct one. I want to be able to pass some other clientside data as well, just getting OS from req header might not be not be enough in my case.
r

rp

05/11/2022, 6:20 PM
Ah i see. Makes sense
FYI, we have a pre API hook on the frontend using which you can inject info into the request body
and then extract that on the backend using the
req
object
s

solminded

05/11/2022, 6:22 PM
oh that sounds good, must have missed that. can you point to that on documentation?
If you can reask this question on stack overflow, I would really appreciate it 🙂 I can answer in more detail as well!
s

solminded

05/12/2022, 2:51 PM
Thanks for the link, since I am using react native I can not use the hooks on clientside but good to know.
r

rp

05/12/2022, 2:52 PM
ah right.. so in that case, you are making the API request from the frontend yourself.
So then adding custom fields to it should be straightforward.