-
Notifications
You must be signed in to change notification settings - Fork 889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom challenge OTP: session expires after 1 retry #4964
Comments
@juchampagne Thanks for opening the issue. Since you using a Custom Challenge to sign in, the logic of expiring OTP's should exist in the Lamda Triggers that were added with the custom Auth challenge. I would suggest to either explore the lambdas to find the business logic that is causing this issue. If you are still not able to figure out, kindly share all the lambdas associated with the Custom Auth and we can try to see if something is wrong there or not. Hope this helps. |
@harsh62 thanks for the reply, please find the lambdas below, on Android with these same lambdas, the OTP expires after 3 tries, but only 2 tries on iOS. create:
define:
and verify:
|
So the problem is that iOS code always start with an
I believe Android works because it might not be going through the
|
@harsh62 ah ok make sense, that can be solved in the lambda definitely👍 Thanks a lot for your help! |
I have implemented the OTP sign in using
AWSCognitoIdentityProvider
a while ago, and have just now noticed that I can only attempt to verify the OTP twice, instead of 3 times, with the latest versions (currently on 2.33.4).I initiate the sign in process by calling
getSession
, which will send the OTP to the user, andgetCustomChallengeDetails
is called one time on success with the USERNAME set. Then the user will enter the OTP and i set the ANSWER on the completion source, which will on success call the continuation block ofgetSession
with a session as the result, orgetCustomChallengeDetails
on failure without a USERNAME set. If it fails the first time, i can retry only one more time, and if it fails the second time,getCustomChallengeDetails
is not called, the error returned in the continuation block ofgetSession
isnotAuthorized
, and the task is now marked as completed so i cannot retry a third time.Unless i am doing anything wrong, it seems that the sdk is invalidating the session after just one retry, on Android with a similar implementation, it allows 2 retries before throwing the
notAuthorized
error, so the user can try 3 times overall which is expected from the lambdas on the server.Here is my implementation:
The text was updated successfully, but these errors were encountered: