Enhance JWT Token Management and Authentication Flow (#720)
- Implement extended token lifetime for "Remember Me" functionality - Add token expiration details to authentication responses - Update client-side token handling to support dynamic expiration - Modify authentication middleware to handle token initialization more robustly - Configure JWT configuration to support longer token lifetimes
This commit is contained in:
@@ -30,7 +30,15 @@ class LoginController extends Controller
|
||||
*/
|
||||
protected function attemptLogin(Request $request)
|
||||
{
|
||||
$token = $this->guard()->attempt($this->credentials($request));
|
||||
// Only set custom TTL if remember me is checked
|
||||
$guard = $this->guard();
|
||||
|
||||
if ($request->remember) {
|
||||
// Use the extended TTL from config for "Remember me"
|
||||
$guard->setTTL(config('jwt.remember_ttl'));
|
||||
}
|
||||
|
||||
$token = $guard->attempt($this->credentials($request));
|
||||
|
||||
if (! $token) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user