PHPackages                             mpociot/reauthenticate - 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. mpociot/reauthenticate

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

mpociot/reauthenticate
======================

Reauthenticate users by letting them re-enter their passwords for specific parts of your app.

1.4.0(6y ago)30235.8k20[2 PRs](https://github.com/mpociot/reauthenticate/pulls)MITPHPPHP &gt;=5.5.9

Since Nov 10Pushed 2y ago10 watchersCompare

[ Source](https://github.com/mpociot/reauthenticate)[ Packagist](https://packagist.org/packages/mpociot/reauthenticate)[ RSS](/packages/mpociot-reauthenticate/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (4)Dependencies (3)Versions (10)Used By (0)

Reauthenticate
==============

[](#reauthenticate)

Because sometimes, you want that extra layer of security
--------------------------------------------------------

[](#because-sometimes-you-want-that-extra-layer-of-security)

[![Software License](https://camo.githubusercontent.com/f251623e510f5909f16ae3f4e6e548dac11340b9fde1a99be26b015b39272c00/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c6174)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/48f57878fa3b7ce3aa12afa3963eeb1e2b02d5c970e1e8882b337bc898560b96/68747470733a2f2f7472617669732d63692e6f72672f6d706f63696f742f726561757468656e7469636174652e737667)](https://travis-ci.org/mpociot/reauthenticate)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/d7fdf9b4ce130bf0495709a0d31ed793bf019a4df8d11d885e96bd3e5af8481d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d706f63696f742f726561757468656e7469636174652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d617374657226)](https://scrutinizer-ci.com/g/mpociot/reauthenticate/?branch=master)[![codecov.io](https://camo.githubusercontent.com/b121fe94edb545fb8dc2900718964c8b602ba0ff9bb02127452584c43ec06b62/68747470733a2f2f636f6465636f762e696f2f6769746875622f6d706f63696f742f726561757468656e7469636174652f636f7665726167652e7376673f6272616e63683d6d6173746572)](https://codecov.io/github/mpociot/reauthenticate?branch=master)[![StyleCI](https://camo.githubusercontent.com/0aa84c2b70371f1d3b4e94a4146dac37a6a1be4e3dba3ed8cb767b205e56c80c/68747470733a2f2f7374796c6563692e696f2f7265706f732f34353933393833362f736869656c643f7374796c653d666c6174)](https://styleci.io/repos/45939836)

Reauthenticate users by letting them re-enter their passwords for specific parts of your app (for Laravel 5).

```
Route::group(['middleware' => ['auth','reauthenticate']], function () {

    Route::get('user/payment', function () {
        // Needs to re-enter password to see this
    });

});
```

Contents
--------

[](#contents)

- [Installation](#installation)
- [Usage](#usage)
- [License](#license)

Installation
------------

[](#installation)

In order to add reauthenticate to your project, just add

```
"mpociot/reauthenticate": "~1.0"

```

to your composer.json. Then run `composer install` or `composer update`.

Or run `composer require mpociot/reauthenticate ` if you prefer that.

Usage
-----

[](#usage)

### Add the middleware to your Kernel

[](#add-the-middleware-to-your-kernel)

In your `app\Http\Kernel.php` file, add the reauthenticate middleware to the `$routeMiddleware` array.

```
protected $routeMiddleware = [
    // ...
    'reauthenticate'         => \Mpociot\Reauthenticate\Middleware\Reauthenticate::class,
    // ...
];
```

### Add the routes &amp; views

[](#add-the-routes--views)

By default, reauthanticate is looking for a route `auth/reauthenticate` and a view `auth.reauthenticate` that will hold a password field.

An example view can be copied from [here](https://github.com/mpociot/reauthenticate/blob/master/views/reauthenticate.blade.php). Please note that this file needs to be manually copied, because I didn't want to bloat this package with a service provider.

The HTTP controller methods can be used from the `Reauthenticates` trait, so your AuthController looks like this:

```
