So from what I can tell, when a user attempts to r...
# contributing
i
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. 🤔
r
Hey the api expects “some” token an input.
So if you don’t provide a token, you get back a 400 error response.
Versus if you provide an invalid token, it gives that type of response with the status
Technically, yea. We could make a missing token return that as well.. but I dont imagine it being too difficult to just pass an empty string if the token isn’t preset at all.
i
Mkay. So
Copy code
ts
const { token = "", ...etc } = formData;
then.
Yeah that's fair enough. Thanks!