PHPackages                             michaeldzjap/twofactor-auth - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. michaeldzjap/twofactor-auth

AbandonedArchivedPackage[Authentication &amp; Authorization](/categories/authentication)

michaeldzjap/twofactor-auth
===========================

A two-factor authentication package for Laravel tuned for use with MessageBird Verify

v3.4.1(1y ago)4351.3k↓50%8MITPHPCI failing

Since Sep 7Pushed 1y ago2 watchersCompare

[ Source](https://github.com/michaeldzjap/laravel-two-factor-authentication)[ Packagist](https://packagist.org/packages/michaeldzjap/twofactor-auth)[ Docs](https://github.com/michaeldzjap/twofactor-authentication)[ RSS](/packages/michaeldzjap-twofactor-auth/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (33)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/2bbae45706804a100161dca32a8c58e7683ba542e44f81a08a6304e73a759bbb/68747470733a2f2f706f7365722e707567782e6f72672f6d69636861656c647a6a61702f74776f666163746f722d617574682f76657273696f6e)](https://packagist.org/packages/michaeldzjap/twofactor-auth)[![Total Downloads](https://camo.githubusercontent.com/77bc62842fe36ceeab4d70211a2574ffa6716a6dd74b5b9b070fd0391e2cf20c/68747470733a2f2f706f7365722e707567782e6f72672f6d69636861656c647a6a61702f74776f666163746f722d617574682f646f776e6c6f616473)](https://packagist.org/packages/michaeldzjap/twofactor-auth)[![Latest Unstable Version](https://camo.githubusercontent.com/342b3c862ab167cb2de263a9e504ae5a4286f1351431480cb37ebc95f15645d0/68747470733a2f2f706f7365722e707567782e6f72672f6d69636861656c647a6a61702f74776f666163746f722d617574682f762f756e737461626c65)](//packagist.org/packages/michaeldzjap/twofactor-auth)[![StyleCI](https://camo.githubusercontent.com/d18183a2106f8ebfb5e43e72009b8746a4ae84afc220a7c09b7fe7ea835a788b/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f39323533313337342f736869656c643f6272616e63683d646576656c6f70)](https://github.styleci.io/repos/92531374?branch=master)[![License](https://camo.githubusercontent.com/52fec428988fdd14d84d8893505e7cdc76e34d108048ed5c561a330fc366e246/68747470733a2f2f706f7365722e707567782e6f72672f6d69636861656c647a6a61702f74776f666163746f722d617574682f6c6963656e7365)](https://packagist.org/packages/michaeldzjap/twofactor-auth)

laravel-two-factor-authentication
=================================

[](#laravel-two-factor-authentication)

A two-factor authentication package for *Laravel* &gt;= 8 (for Laravel 5 to 7 you will need version 1 or 2 of this package)

Table of Contents
-----------------

[](#table-of-contents)

- [Description](#description)
- [Important](#important)
    - [Optional Correction](#optional-correction)
- [Installation](#installation)
- [Changes to the Login Process](#changes-to-the-login-process)
    - [Failed Verification Attempt Handling](#failed-verification-attempt-handling)
- [Using a Custom Provider](#using-a-custom-provider)
- [Errors and Exceptions](#errors-and-exceptions)
- [Testing](#testing)

Description
-----------

[](#description)

This is a two-factor authentication package for *Laravel*. It is heavily inspired by the [Laravel Two-Factor Authentication](https://github.com/srmklive/laravel-twofactor-authentication) package. The main differences between this package and the aforementioned package are:

- This package currently only works out of the box with the *MessageBird Verify* api or the `'null'` driver that goes through all the steps of the two-factor authentication process without actually doing any real verification. This could be useful for testing purposes. You can however, specify a custom provider yourself.
- This package uses throttling to limit the number of unsuccessful authentication attempts in a certain amount of time.
- The current version of this package is only guaranteed to work with *Laravel* &gt;= 8. Version 2.\* of this package works with *Laravel* 5.5 to 7. Version 1.\* of this package works with *Laravel* 5.4. Versions of *Laravel* prior to 5.4 have not been tested.

Important
---------

[](#important)

From *Laravel* 5.8 and onwards, the default is to use `bigIncrements` instead of `increments` for the `id` column on the `users` table. As such, the default for this package is to use the same convention for the `user_id` column on the `two_factor_auths` table. If this is not what you want, you can change this to your liking by modifying the migration files that are published for this package.

Publishing the package's migration files allows for more flexibility with regards to customising your database structure. However, it could also cause complications if you already have ran migrations as part of installing previous versions of this package. In this case you simply might want to bypass running the migrations again or only run them when in a specific environment. The `Schema::hasColumn()` and `Schema::hasTable()` methods should be of use here.

### Optional Correction

[](#optional-correction)

Versions of this package prior to v2.3.0 incorrectly created the `user_id` column on the `two_factor_auths` table using `increments` instead of `unsignedInteger`. Practically speaking, this error is of no concern. Although there is no need to have a *primary* key for the `user_id` column, it doesn't cause any problems either. However, if for some reason you don't like this idea, it is safe to remove the *primary* key using a migration of the form

```
