This commit is contained in:
Билай Станислав 2024-10-21 15:56:51 +03:00
parent 68615d1f8d
commit 215d2b1290

View File

@ -35,17 +35,17 @@ class SecureRestController extends RestController
"iat" => time(),
"exp" => date("Y-m-d H:i:s", strtotime("+30 days"))
],
key: $model->{'password_hash'},
key: $model->password_hash,
alg: 'HS256'
);
$model->{'access_token'} = $jwt;
$model->{'access_token_expires_at'} =
JWT::decode($jwt, new Key($model->{'password_hash'}, 'HS256'))->exp;
$model->access_token = $jwt;
$model->access_token_expires_at =
JWT::decode($jwt, new Key($model->password_hash, 'HS256'))->exp;
$res = [
"access_token" => $model->{'access_token'},
"access_token_expires_at" => $model->{'access_token_expires_at'},
"access_token" => $model->access_token,
"access_token_expires_at" => $model->access_token_expires_at,
];
}
$model->save();