Hi, When i do OTP signin i get error [E061101] wit...
# general
l
Hi, When i do OTP signin i get error [E061101] without any explanation, the verify code is sent and i verified correctly. what this Error means ?
m
hey @Lior Nabat (BelugaHealth) We are working these days to improve our error msgs, specifically the one you got when did you got this error ? will try to look up what caused it , also plz send me your project ID on DM to make it quicker
l
project id: P2IFxsJ9hL1rnAGopK9WV6yaFqRR
2022-12-17 145249.797 Error Descope-client: User signed in email: lior.nabat@gmail.com completed with error: [E061101]
m
it seems you sent OTP, as phone number, not email
can you paste here the code snippet you used ?
you need to make sure the delivery method is email instead of phone/SMS
l
why ?
i want that the code will be sent in sms
m
in that case, the identifier should be the phone number, not the email
l
ok,
will try
the same error
m
can you paste the code snippet you are using ?
l
Copy code
func (c *Client) OPTSignIn(ctx context.Context, request *requests.OTPSignIn) error {
   identifier := request.Phone
   if err := c.client.Auth.OTP().SignIn(auth.MethodSMS, identifier, request.R, &auth.LoginOptions{}); err != nil {
      c.logger.Errorf("user signed in email: %s completed with error: %v", request.Phone, err)
      return err
   }
   c.logger.Infof("user signed in successfully, email: %s", request.Phone)
   return nil
}
m
seems that user doesn't exist, did that user sign up before ? do you see him in the user table (with his phone)? maybe use instead of
Copy code
c.client.Auth.OTP().SignIn
use:
Copy code
c.client.Auth.OTP().SignUpOrIn
if what you mean , is that user can sign up or in , in every attempt
l
i do sign up before
Copy code
func (c *Client) OTPSignUp(ctx context.Context, request *requests.OTPSignUp) error {
   identifier := request.Phone
   user := &auth.User{
      Name:  request.Name,
      Phone: request.Phone,
      Email: request.Email,
   }
   if err := c.client.Auth.OTP().SignUp(auth.MethodSMS, identifier, user); err != nil {
      c.logger.Errorf("user signed up name: %s, email: %s, phone: %s completed with error: %v", request.Name, request.Email, request.Phone, err)
      return err
   }
   c.logger.Infof("user signed up successfully, name: %s, email: %s, phone: %s", request.Name, request.Email, request.Phone)
   return nil
}
then sign in
m
ok, did you sign up that user with his phone ? or email ?
ohh I see now
l
see,
phone
m
do you see him in user table?
l
only after i do verify
i get the sms code even if i have error
m
emm, maybe I misunderstood you you need to have complete signup, before you can do signin meaning, you get the code, verify , user is created only after that is done, you can do the signin methods
so after you do full signup (with phone) you try signin, and you still get error on SDK ?
l
here are the steps: 1. Signup - works 2. Signin - getting the error 3. Verify - works
all iwht phone
with
m
ok, so this is the missing part a
full
signup , means 2 funcs: 1. SignUp call
Copy code
descopeClient.Auth.OTP().SignUp(deliveryMethod, identifier, user)
2. Verify :
Copy code
descopeClient.Auth.OTP().VerifyCode(deliveryMethod, identifier, code, w)
you need to call both, one by one, to complete the signup for a user after this is done, user will be in the user table, persisted and user can do signin
l
OK,
testing
did that:
1. signup 2. verify all is ok, user in the table 3. signin - the same error
m
is it user with phone number ending with
333
? is that user appearing in user table with that number ?
l
yes
m
is the user appearing with number under the ID column ?
or the ID is something else? like email?
l
m
did you try to signin , when giving the phone with a dash ?
+972-5******
?
l
checking
ok, now this is good, i have to remove the -
m
Great! We will work on our side on better errors back from SDK And improve our docs, I see now https://docs.descope.com/build/guides/backend_sdks/otp/ Can be a bit misleading about the func call order
l
i'm getting now: "iat\" not satisfied
on verify
this happen if i do 2 verifications one after one,
m
so you mean you do: 1. sign in 2. verify 3. verify (on same code as above ?)
l
1. sign in 2. verify 3. signin 4. verify
m
if you wait like 2 min between step 2 and 3, same error ?
you get error only in step 4 right ? are you sure you pass it the right code ? from step 3 ?
also try this plz :
Copy code
VerifyCode
without the
Copy code
w writer argument
l
yes,
in step 4
if i wait for 2 min, it's fine
m
try to pass nil for the writer
l
ok
this works
fine
so i'll set it to nil
m
👍