1

I am using Laravel 8 and implement API's. Everything is working fine but token expire after sometime in mobile app. There is any way to set token expiry until user logout from mobile device. I have read articles and perform some changes but still stuck in this issue. In Config/jwt.php i have change like this,

//    'ttl' => env('JWT_TTL', 60),
'ttl' => env('JWT_TTL', null),

and

    'required_claims' => [
    'iss',
    'iat',
    'nbf',
    'sub',
    'jti',
],

//    'required_claims' => [
//        'iss',
//        'iat',
//        'exp',
//        'nbf',
//        'sub',
//        'jti',
//    ],

In auth controller i have login as,

$user = User::where('mobile', $request['mobile'])->first();

    if ($user){
        if(!$token = JWTAuth::fromUser($user)){
            return $this->responseWithError('Phone Number is Incorrect!', Response::HTTP_UNAUTHORIZED);
        }
    }else{
        return $this->responseWithError('Phone Number does not exist!', Response::HTTP_OK);
    }

Anyone can help me how to solve this issue?

Irshad Khan
  • 161
  • 2
  • 15

0 Answers0