authenticationlaravel-5routes.htpasswd

Protect a given Laravel route with htaccess password


Is it possible to protect one!! laravel route with htaccess password?

I have a migrator route and that one should be accessed with a htaccess password


Solution

  • You can try Laravel HTTP Basic Authentication to protect a route in a simple way:

    Route::get('your-route', function () {
       // Only authenticated users may enter...
    })->middleware('auth.basic');
    

    Please note that, by default, this technique uses email and password stored in 'users' table to give access to an user.