Laravel default login redirection not working

Posted 4 months ago by JanakaDombawela

Hi I have installed the Laravel 5.7 version and when I go to authenticated url it redirects to the login page, but after login it redirects to home page.

This authenticated url could be any url that is authenticated with laravel auth middleware.

Here is my example router resource code for the url:

Route::namespace('User')->group(function () {
    Route::middleware('auth')->resource('delivery', 'DeliveryController');
});

The default behavior is when we try to go to a authenticated url it should redirect to login and after login it should redirect back to the authenticated url.

Ex:

delivery->login->delivery

customer->login->customer

But the problem is whatever url I call it redirects to home page (which is the $redirectedTo in LoginController) after login. I have installed the passport for API authentication. Can anyone suggest me where should I start looking?

Please sign in or create an account to participate in this conversation.