Hey guys, I’m implementing the `verification flow`...
# talk-kratos
c
Hey guys, I’m implementing the
verification flow
and I have a question. Can I “re-send” the email verification with a new link when it was expired but without put the email again? I mean, I’m trying to implement the “resend verification link to my email” feature when the link is expired or not valid 🙂 Thanks in advance!
p
Hi @cool-engine-68327 What do you mean? When you do the verification flow it initializes things like csrf cookies and a flow ID. You then need to submit the email to Kratos and this is only a singular submission per flow ID / csrf cookie.
c
Hey, hi
I want to implement the “resend verification email” flow My use case is the following: 1. My user wants to perform a registration operation. We initialize the flow and send the information to Ory. 2. My user receives an email with the link that he must use to verify her account. 3. This link expires, therefore, my user needs to receive an email again with a new link to verify. 4. I want to implement a simple button that resends said email, but without having to force my user to re-enter his email on the verification screen, it seems to me that it is not correct since if I obtain information about the status of the verification (for example, the token expired) should be able to automatically resend a new one, right?
I understand that I could save the user’s email somewhere (cookie, sessionStorage, etc) but I wanted to know if Ory has a way to perform this action “automatically” and without interaction from us. I imagine that the “correct” thing would be that the verification flow could be “restarted” by sending it the FlowID or something like that, but well, my question is that, what would be the path to follow to achieve this behavior?
e
@nice-nail-87463 any thoughts?
p
I guess your application could do the flow for the user if the user has a session. For instance, I can do the email flow without having a session and I can do it with a session. In the case of a session we could have your system check the verification status and then if not verified, do an ajax call for the verification init, auto get the email from the current session and complete the verification flow. This can all be done in Ajax in the background, with no user interaction.
If you have a different usecase where you are storing who has done a verification flow, however you keep track of the verification status and expiry date, you could extract this information on your server and redo the flow in the same manner without them having a session.
e
it can start again the flow, but I need the user email to submit the data and re-sent the email. I do not see how to send that submit without asking the mail to user and not using an storage (sessions, cookies, etc)
p
The user doesn't need to be verified for instance to log in. You could do restrictions in your app depending on the verification status, which you can retrieve (with their email) from the
sessions/whoami
endpoint.
e
Basically, i have a csrf token and use it for all my calls. I don't wanna have more info saved in localstorage or somewhere else which is not safe. what do u recommend as good practice?
p
yes, i do not recommend you store any long-term information inside a client-side application (e.g. Chrome localstorage). You have a couple of options: 1. Assuming the user is still on the same computer waiting for the link etc. then you can store the user email they registered with in-memory. Obviously if the user closes the browser the data will be gone. 2. If you have a different usecase where you are storing who has done a verification flow - you keep track of the verification status and expiry date - you could extract this information on your server and redo the verification flow automatically. 3. In the case of a session we could have your system check the verification status and then if not verified, do an ajax call for the verification init, auto get the email from the current session and complete the verification flow. This can all be done in Ajax in the background, with no user interaction.