All Projects → thecodework → two-factor-authentication

thecodework / two-factor-authentication

Licence: MIT license
Two Factor Authentication for Laravel

Programming Languages

PHP
23972 projects - #3 most used programming language
Blade
752 projects

Projects that are alternatives of or similar to two-factor-authentication

laravel-two-factor-authentication
A two-factor authentication package for Laravel >= 8
Stars: ✭ 37 (+76.19%)
Mutual labels:  laravel-5-package, two-factor-authentication
Laravel Database Encryption
A package for automatically encrypting and decrypting Eloquent attributes in Laravel 5.5+, based on configuration settings.
Stars: ✭ 238 (+1033.33%)
Mutual labels:  laravel-5-package
Partyline
Output to Laravel's console from outside of your Command classes.
Stars: ✭ 168 (+700%)
Mutual labels:  laravel-5-package
Voyager Hooks
Hooks system integrated into Voyager.
Stars: ✭ 200 (+852.38%)
Mutual labels:  laravel-5-package
Laravel Cart Manager
Managing the cart in your Laravel/E-commerce application is a breeze
Stars: ✭ 175 (+733.33%)
Mutual labels:  laravel-5-package
Hooks
Hooks is a extension system for your Laravel application.
Stars: ✭ 202 (+861.9%)
Mutual labels:  laravel-5-package
Telegram Bot Sdk
🤖 Telegram Bot API PHP SDK. Lets you build Telegram Bots easily! Supports Laravel out of the box.
Stars: ✭ 2,212 (+10433.33%)
Mutual labels:  laravel-5-package
Laravel Gitscrum
GitScrum is a Project Management Tool, developed to help entrepreneurs, freelancers, managers, and teams Skyrocket their Productivity with the Agile methodology and Gamification.
Stars: ✭ 2,686 (+12690.48%)
Mutual labels:  laravel-5-package
Auth Tests
Always-current tests for Laravel's authentication system. Curated by the community.
Stars: ✭ 230 (+995.24%)
Mutual labels:  laravel-5-package
Blogetc
Easily add a full Laravel blog (with built in admin panel and public views) to your laravel project with this simple package.
Stars: ✭ 198 (+842.86%)
Mutual labels:  laravel-5-package
Laradmin
Laradmin后台管理系统
Stars: ✭ 197 (+838.1%)
Mutual labels:  laravel-5-package
Laravel Translation Manager
Enhanced Management of Laravel 4 & 5 Translations, with Yandex Translation API assisted translations.
Stars: ✭ 178 (+747.62%)
Mutual labels:  laravel-5-package
Sneaker
An easy way to send emails whenever an exception occurs on server.
Stars: ✭ 223 (+961.9%)
Mutual labels:  laravel-5-package
Lapse
Laravel Self Hosted Tiny Error Tracking System With Notifications
Stars: ✭ 172 (+719.05%)
Mutual labels:  laravel-5-package
Laracrud
Laravel Code Generator based on MySQL Database
Stars: ✭ 238 (+1033.33%)
Mutual labels:  laravel-5-package
Laravel Page Speed
Package to optimize your site automatically which results in a 35%+ optimization
Stars: ✭ 2,097 (+9885.71%)
Mutual labels:  laravel-5-package
Laravel Tournaments
Laravel Package that allows you to generate customizable tournaments trees.
Stars: ✭ 196 (+833.33%)
Mutual labels:  laravel-5-package
Voyager Frontend
The Missing Front-end for The Missing Laravel Admin 🔥
Stars: ✭ 200 (+852.38%)
Mutual labels:  laravel-5-package
crotp
CrOTP - One Time Passwords for Crystal
Stars: ✭ 62 (+195.24%)
Mutual labels:  two-factor-authentication
Bouncer
Eloquent roles and abilities.
Stars: ✭ 2,763 (+13057.14%)
Mutual labels:  laravel-5-package

Build Status Scrutinizer Code Quality StyleCI License

Laravel Two Factor Authentication (2FA)

Two

Two Factor Authentication or 2-Step Verification provides stronger security for your Account by requiring a second step of verification when you sign in. In addition to your password, you’ll also need a code generated by the Google Authenticator app on your phone. This package implements TOTP defined in RFC 6238

Requirements

  • PHP >= 7.1
  • Laravel >= 5.3
  • Google Authenticator Android - iOS (Recommended) or Authy mobile app

Installation

1. Composer Install

$ composer require thecodework/two-factor-authentication

Note - If your're using Laravel 5.5 or newer version then auto-discovery-pacakge would automatically update the providers and you could skip to Step 3

2. Add Service Provider

After requiring the package add TwoFactorAuthenticationServiceProvider::class into providors array in app.php confi file

[
 'providers' => [
    //...
    Thecodework\TwoFactorAuthentication\TwoFactorAuthenticationServiceProvider::class
  ]
]

3. Publish the ConfigFile

Publish config file

$ php artisan vendor:publish --provider="Thecodework\TwoFactorAuthentication\TwoFactorAuthenticationServiceProvider" --tag=config

Once the config file is published you can navigate to config directory of your application and look for 2fa-config.php file and change configuration as you want.

4. Run Migrations

Now run the migration

$ php artisan migrate

It will use the default User model and adds two columns is_2fa_enabled and secret_key.

5. Add AuthenticatesUserWith2FA trait in the LoginController

Now the config file is placed. The last thing to do is addding AuthenticatesUsersWith2FA trait in the Http/Controllers/Auth/LoginController.php file which helps to stop user at verify-2fa page to enter TOTP token after each login.

The final snippet will look like this.

use AuthenticatesUsers, AuthenticatesUsersWith2FA {
    AuthenticatesUsersWith2FA::authenticated insteadof AuthenticatesUsers;
}

Note: Don't forget to include use statement use Thecodework\TwoFactorAuthentication\AuthenticatesUsersWith2FA in the header.

6. Setup 2FA for user

• Enable 2FA

Now login to the application and visit /setup-2fa/ route, which will show a barcode which can be scanned either using Google Authenticator or Authy mobile application as described above. Scan that code and click Enable Two Factor Authentication.

• Disable 2FA

To disable Two Factor, visit /setup-2fa route, which will now show a Disable Two Factor Authentication button. Click to disable 2FA for your account.

7. Testing 2FA

Now to test 2FA, perform logout and log back in again, it will ask you to enter Token which can be obtain from the authenticator mobile application. Enter the token and you're logged in.

Additionally

If you want to publish views, and migration as well along with config file then run

$ php artisan vendor:publish --provider="Thecodework\TwoFactorAuthentication\TwoFactorAuthenticationServiceProvider"

Contribution

Feel free to create issues, submit PRs and talk about features and enhancement through proposing issue. If you find any security consideration, instead of creating an issue send an email to [email protected].

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].