How to automatically log the user in after email verification

System Information
  • Strapi Version: 4.10.2
  • Operating System: MacOS / Linux
  • Database: MySQL
  • Node Version: 18
  • NPM Version: 9.5.1
  • Yarn Version: 1.22.19

Hi,
I’m using Strapi with the passwordless authentication plugin. When users complete the registration form, they only provide an email and some personal info and then trigger a email verification. They currently have to click the link inside their email to be redirected back to the login page, then enter their email again, return to their email and click another link just to login.

Our application is targeted at an older user population and this initial multi-step signup / signin process is extremely confusing. Everyone expects to click the link inside their email after registering and then get signed in right away. They can’t understand that they need to re-enter their email and then click another link.

So we want to change one aspect of the /auth/email-confirmation?confirmation=<code> endpoint. Instead of just redirecting to the a static URL, we would like to generate a JWT and include that in the re-direct so the front-end can store it in session storage and log the user in.

Any help in how to accomplish this without causing security issues or future upgrade issues would be amazing. Thanks!

2 Likes

Hello, did you manage to do the above? I am interested in exaclty the same flow.

Up! I am interested in the same flow.

https://forum.strapi.io/t/strapi-email-confirmation-validation-api-endpoint/2261/13

code example. with that you will get the user info and the JWT as an answer from confirmation api request.