I am facing a problem regarding ory email otp base...
# general
r
I am facing a problem regarding ory email otp based auth, I am using vite react. After email entered and submitted to send otp to the provided email, I recieve otp on my email but Api throws a Bad Request 400, but in response I get this message in nodes: "A code has been sent to the address(es) you provided. If you have not received a message, check the spelling of the address and retry the registration." Why is this happening please help. Using ory/client sdk for react with self service ui using cloud api from ory project, using tunneling on localost 4000.
b
That's expected. Is it causing a problem for you?
r
I mean is it normal flow?
b
yes
r
as you can see in this image
@bland-eye-99092 can you please clarify that as I need to create poc for this its really urgent your any help will be appreciated.
b
yes, that's the expected behavior. It's not an error, per-se, but the API needs more information, e.g. the code sent via email.
r
My whole flow is: 1) first initiazte registration flow using ory client for react/nextjs (method: createBrowserRegistrationFlow ) 2) I get the flow Id in response all the details csrf_token and everything. 3) then I update my flow with email i want to send otp too here u can see:
Copy code
ory.updateRegistrationFlow({
        flow: flow.id,
        updateRegistrationFlowBody: {
          method: "code",
          traits: { email: values.email   },
          csrf_token: values.csrf_token,
        },
      })
after this I get that such behaviour as I shared the image with you. the problem i am having as promise is getting rejected still I am able to receive code on email. is wierd. I need to handle my next step to verify otp in the catch block. this is all happening in local env I get code then I again update flow with code i recieved on mail. then api response with success .
@bland-eye-99092 But I think theres a problem in email-otp auth. after initiating register flow, and updating flow with email to get otp on mail. this should not ask for code, at this step i dont have otp yet what i will provide as code value and dont get validation error 400. this step below.
Copy code
ory.updateRegistrationFlow({
        flow: flow.id,
        updateRegistrationFlowBody: {
          method: "code",
          traits: { email: values.email   },
          csrf_token: values.csrf_token,
        },
      })