I am using Custom authentication and middleware but when using logoutOtherDevices function its working but redirecting them to /login. And i want to redirect them to home page ie /home
You need to override the unauthenticated method that are extendble class of app\/Exceptions\/Handler.php, this file is the default file of laravel that handle when the session expired. To solve that just write this code in your app\/Exceptions\/Handler.php
protected function unauthenticated($request, AuthenticationException $exception)
{
return $request->expectsJson()
? response()->json(['message' => $exception->getMessage()], 401)
: redirect()->guest($exception->redirectTo() ?? route('YOUR ROUTE HERE'));
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.