Sorry another question regarding the Passwordless ...
# support-questions-legacy
m
Sorry another question regarding the Passwordless recipe: I'm trying to use signInUp in the createCode function override in order to create my user earlier, but it kind of hang/freeze the function. Any idea? Thanks.
r
hey @masterofpoupette i don't quite get what you are trying to do here. Can you elaborate?
m
I'd like to already create a user at this step, so I call signInUp, but it fails to go beyond signInUp. No error, createCode is called again and again with a new preAuthSessionId.
r
It’s going in an infinite loop, since signInUp calls createCode
Consider instead, overriding the api createCodePOST
m
okey thx
signInUp works that way, thank you! However, it's the consumeCode now that fails. It returns "RESTART_FLOW_ERROR" directly (work great until I override createCodePOST).
r
im going to need more info about your workflow
m
this is my createCodePOST where I call signInUp in order to create the user at this step and add some metadata. Since I'm overriding the api instead of the function like you suggested, it works great.
this is my consumeCode (I also tried consumeCodePOST), where I would like to get the metadata, however since I call signInUp in createCodePOST, response.status is never "OK".
consumeCode is called from signInUp
r
so calling signInUP will call consumeCode, if signInUp succeeds, then consumeCode also must have succeeded, and your override logic will also have run. Am i missing something?
m
since consumeCode is called by signInUp inside createCode, when the magic link is open by the user, it triggers a "RESTART_FLOW_ERROR".
r
oh yea. Ofc.
m
In my case, ideally, consumeCode should only be called from the magic link, not on signInUp
r
im a little confused..
signinup creates a user in passwordless recipe
create code API sends an email to the user
why are you calling signinup in create code?
m
I want to add some metadata to the user based on where he calls createCode, so I'm trying to create a user at this stage by calling signinup.
r
don't do that. Save the info in createCode agains the preAuthSessionId in your db, and in consume Code, once it's successful, then fetch that info using preAuthSessionId and then add it to the metadata.
m
ok I will try to convince the db guy that we must create a new table 😅
thanks for your time
3 Views