Closed mzhaiclh closed 2 years ago
Hi @mzhaiclh thank you for creating an issue. I think we should improve the consistency of our response.
We should only return a Token object if the OTP is correct in all other cases we should return an exception.
As you pointed out, currently the exception doesn't have all the info needed to properly identify the error, I think we should add it.
We will add all of this on a new version of the library, which should be out soon
Awesome, thank you so much! :)
Verifying a token returns:
This behavior is inconsistent for the following reasons:
Since the library cannot access what the expected number of digits in the OTP is for an Authy app, one potential solution is to create a Token object that has the same status code as the normal "incorrect token" response and add the current message in the AuthyException as the message.