Route without authentication Laravel

Asked

Viewed 634 times

0

Good morning

I need to free a REST service on a system with authentication, in Laravel 5.1, so when I access the REST address in a place that is not authenticated, it asks to enter login and password, but this service will not need authentication, because it will be used by another system of our own company for small consultations.

Is there any way to clear a route on Laravel that doesn’t pass the authentication that already exists? Everything I try to do the system forwards to the login page and password to authenticate, before I can use the service.

Thanks in advance

  • You are checking the User in the Routes.php? file to post an example of the route you are using?

  • I believe it’s some class that’s extended by the controller, so I couldn’t dig any deeper. I don’t think it’s done on the route, because on route.php there are routes like this, which still asks for authentication: Route::get('/test', ['as' => 'client.test', 'uses' => 'Clientcontroller@test']);

  • Check whether in the controller or Extended Parent constructor you make use of middleware, for example: $this->middleware('auth');

  • The route you need to clear is within some group of routes (Route::group()) ?

  • Jao Assy, I didn’t find this use of middleware, but because of it I was able to discover the Redirectifauthenticated.php class, in App/Http/Middleware that in this case was controlling the authentication exceptions. Really worth it

1 answer

2

If authentication is done through middleware

Route::group(['middleware' => 'auth.basic'], function() {

  //Rotas autenticadas

});

  //Rotas não autenticadas

Route::get('approve', ['as' => 'approve', 'uses' => 'Web\CustomerCardController@approve_customer_card']);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.