Krizalys Onedrive session client state

I’m using this library https://github.com/krizalys/onedrive-php-sdk. The starting steps look good, after successful authentication, I can use $_SESSION['onedrive.client.state'] to work.

$client = Onedrive::client(
$config['ONEDRIVE_CLIENT_ID'],[
'state' => $_SESSION['onedrive.client.state'],
]
);

But when the session expires, it gives error Fatal error: Uncaught MicrosoftGraphExceptionGraphException: [0]: No access token has been provided I can’t start index.php and ‘rediect.php’ over again every time.

I have many search but not found results.

Thanks

Fatal error: Uncaught MicrosoftGraphExceptionGraphException: [0]: No access token has been provided