asp.net-web-apiuser-managementemail-confirmation

User email confirmation options?JWT?


  1. I have a front end in react and a backend in asp.net core web api.
  2. I have already a login with jwt tokens and register using hashing and salt to store in db.
  3. I want to implement an email confirmation when the user registers in my site.
  4. Should i use jwt to generate token and send this jwt in the email to user

Im not finding much solutions, need some suggestions


Solution

  • a typical way of building an email validation thing, with a one time code, would be to use a GUID. In the email you sent, add a link with this unique GUID attached at the end something like :

    www.something.com/email-verify/877ebd19-6852-4de9-b228-4d796a4cd7c7

    you create a table in your db where you store these generated tokens with the a user id so you know which user it is when they click the link, add a used flag so you know you only accept it once and you're pretty much done.