I’m using Stitch to create a email/password login system. I’m using the Stitch Email/Password provider with the “user confirmation method” setting of “send a confirmation email”.
My app is working to the point where I can submit my app’s register form, then see my entry in the Stitch Users screen as a pending user.
After registering, Stitch sends a confirmation email with a link to “Confirm email”.
It’s been a while since you posted this question, have you found a solution yet ?
There are two parts to the error, first is expired token and the second is invalid token. The token is valid within 2 hours, so please make sure that the email that you actioned is the one that is sent by Stitch within the time period.
The second case, is invalid token. Could you post the code snippet that you used to pass token and tokenId to UserPasswordAuthProviderClient to confirm ?
Thanks Wan. No, I have not found a solution yet. To answer your questions:
There are two parts to the error, first is expired token and the second is invalid token. The token is valid within 2 hours, so please make sure that the email that you actioned is the one that is sent by Stitch within the time period.
After registering, I am immediately opening the confirm user email and clicking the Confirm Email button.
The second case, is invalid token. Could you post the code snippet that you used to pass token and tokenId to UserPasswordAuthProviderClient to confirm ?
Thank you for the code snippet. That looks correct.
Given your code snippet and a valid URL that’s provided by Stitch, the only way I could reproduce the userpass token is expired or invalid is if I tried to execute the same token after it’s been validated/confirm (i.e. executing twice).
If you register a new user email/pwd, and you click the link from the email, does the user status changed to confirmed in Stitch’s Users tab ? If so, there’s a possibility that your React code may have executed/triggered twice.
If you still encountering this issue, could you provide a minimal reproducible example ?
I may have encountered the same issue you are having and I may have an answer for you:
When a user registers themselves for the first time they are assigned a status called Pending Confirmation. Once confirmUser(token, tokenId) has been called, the status moves from Pending Confirmation to Pending User Login, but the user still remains in the Pending category.
Subsequent calls to confirmUser(token, tokenId) if the user is already in Pending User Login will result in the error message you mentioned!
All that’s left to do is for the user to login and the user will be confirmed.