strapi / community-content

Contribute and collaborate on educational content for the Strapi Community
https://strapi.io/write-for-the-community
571 stars 403 forks source link

Adding Two-Factor Authentication (2FA) in Strapi with Users and Permissions via Email and Authenticator App #1568

Open emekaemego opened 1 week ago

emekaemego commented 1 week ago

What is your article idea?

In this tutorial, I will guide readers in in adding two-factor authentication (2FA) via email and authenticator apps to Strapi application by extending the Users and Permissions plugin. I will walk through the process of adding 2FA to enhance the security of user authentication, while explaining the backend and frontend implementations.

The article will describe how to override and extend the default register and login actions, and routes of the Users and Permissions plugin with custom controller and actions, create a custom Content Type for managing email-based one-time passwords (OTP), and extend the User and Permissions model to handle Time-based One-Time Password (TOTP) information. The tutorial will cover generating and validating TOTP codes for authenticator apps like Google Authenticator and enabling QR code display on the frontend to make the process user-friendly.

Also, the tutorial will introduce and explain what 2FA and TOTP are, describe different approaches of extending the register and callback actions for implementing 2FA, and explain why the chosen method.

The article will cover:

What are the objectives of your article?

The key objectives of this article are:

What is your expertise as a developer or writer?

Advance

What type of post is this?

Tutorial

Terms & Conditions

Theodore-Kelechukwu-Onyejiaku commented 3 days ago

Hi @emekaemego ,

Could you please be more specific about the idea you are proposing. Do you want to extend Strapi by creating an OTP-based User Sign-Up with and email provider using Strapi?

emekaemego commented 3 days ago

Hi @emekaemego ,

Could you please be more specific about the idea you are proposing. Do you want to extend Strapi by creating an OTP-based User Sign-Up with and email provider using Strapi?

Hi @Theodore-Kelechukwu-Onyejiaku ,

Yes, I want to extend Strapi by creating an OTP-based user Sign-In with the email provider using Strapi. To simplify: