Hi again, I am trying to get password reset email ...
# support-questions
s
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
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
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
these extra form fields only apply to the sign up page
not the reset password page
s
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
That would work too (you should use ThirdPartyEmailPassword.createResetPasswordToken). But what I suggested originally, why would that not solve your use case?
s
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
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
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
Thanks for the link, since I am using react native I can not use the hooks on clientside but good to know.
r
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.