Member-only story
Laravel 2FA Login with Microsoft Authenticator App
Two Factor Authentication (2FA) is an extra layer of protection used to ensure the security of online accounts beyond just a username and password. This 2FA already implemented in most modern website as extra layer of security. This 2FA basically requires you to verify your identity using a randomized 6-digit code.
Why Microsoft Authenticator App? Because its free! 😂
BTW, Adding 2FA in Laravel is quite simple actually. Make sure you install Microsoft Authenticator App in your device. This 2FA already in Fortify package and Jetstream Laravel. But i would like to create it myself so i have full control of it. 😜
Note that, this tutorial is just snippet of codes. Any UI or extra code need to create by yourself. This article intended to show how the 2FA can be used. This article is for intermediate developer
Install composer package
# composer require pragmarx/google2fa //required
# composer require endroid/qr-code // can change to your prefered QR package
Create a class, let’s call it as TwoFactorAuthenticationProvider
.