Morning! Firstly, big thank you for creating super...
# support-questions
m
Morning! Firstly, big thank you for creating supertokens, loving it so far. However I'm getting stuck adding additional fields to the sign up form, following the guide here: https://supertokens.com/docs/emailpassword/common-customizations/signup-form/adding-fields I do step 1 and 2 - that all works fine, but then the next part seems to contradict step 2. I am assuming that this is instead of step 2 but it's not clear to me (I'm new to this). Secondly I'm aware supertokens wont store the data from the additional fields, so if I only do step 1 and 2, how do I handle the extra form field data on the backend? Thanks in advance!
r
hey @M/\X
Do you mean about "Handle form fields on successful Sign-up" step?
m
👋
Is that step 3 or instead of step 2?
r
thats step 3.
I guess we should add a "Step 3:" to it
m
Ah ok - thanks for that. The thing thats confusing me is it seems to imply that I replace the code I wrote inside EmailPassword.init({}) on step 2?
r
ah right. You don't have to raplce it. You need to add that code as well.
m
ahhh
r
and you can use the user metaddata recipe to store the extra info
m
The rest of the code was the same but the stuff from step 2 was missing so it threw me off
r
i see. we will make chanegs to the docs.
m
r
yes
m
Fab - I will look into that today, thank you very much for your help!
One last question: Regarding the steps here: https://supertokens.com/docs/emailpassword/common-customizations/redirect-to-auth Can the query param ?redirectToPath=/somepath be added to the base path of '/auth' to send the user onto to somewhere else? Haven't tried it out yet as just planning
r
im not sure i understand that question
could you elaborate?
m
Sure!
I want to send a user to website.com/auth from another page. However I want to control where that user goes next, not just return them to website.com. Will sending the user to website.com/auth?redirectToPath=/profile send the user to the profile route? I'm just checking I've interpreted the docs correctly here
Copy code
if (context.redirectToPath !== undefined) {
  ...
}
In the above if block from the code snippet in the link, instead of doing
return context.redirectToPath;
, you can return a path that you like.
m
How about if I wanted the sign up flow to be different to the sign in flow?
r
The
context
object has
context.isNewUser
. It will be true if it's sign up. Else it will be
false
.
m
Fantastic - will also have a look into this today
I really appreciate the speedy support, thank you very much @rp !
Hey @rp , is there a simple way to get the userID for the newly created user next to formFields on step 3 here: https://supertokens.com/docs/emailpassword/common-customizations/signup-form/adding-fields
r
Yea. I think it would be response.user.id
Check the type of response
m
ah fantastic that worked a treat - thank you