So from what I can tell, when a user attempts to reset their password with an invalid token, SuperTokens returns an object with
{ status: RESET_PASSWORD_INVALID_TOKEN_ERROR }
. If the developer is keeping track of these kinds of error strings as "enums", he/she can respond to this pretty easily by observing
data.status
.
However, if the user requests a password reset without a token, the returned error object is different and instead looks like:
{ message: 'Please provide the password reset token' }
.
This discrepancy makes it a bit difficult for developers to have a unified approach to responding to errors. (For instance, I usually do
if/then
checks on
data.status
to know how to go about returning error messages to the frontend in a response.)
Is there any chance that missing token error objects could also be given an error
status
property? Maybe
RESET_PASSWORD_MISSING_TOKEN_ERROR
? Or, I guess technically it could have the same status as with an invalid token... since tokens aren't allowed to be undefined. 🤔