How to clear the localStorage when session expires?

I am building a DApp that is based on roles . When a user is logged is logged in using web3auth modal , based on his address and the address that is saved in smart contract for a specific role , his UI is rendered . Each user with a different role will see a different UI .
I know that by default web3auth session expiry is set to 86400 seconds ( 1 day ) . I want to clear localStorage of a logged in user when the session has expired . How can I do so ?
Does web3auth provide any method for checking whether a session is valid or it has expired ?

@pantgaurav31 Thanks for your question.

Your request has been forwarded to our team and we will get back with further update once more information becomes available.

If the session is valid, the user will be auto-logged in and you get an idtoken back which has the same expiry as the session.
if the session is expired, user will be logged out.
You can add a listener on idtoken expiry if you need an event.

is there any listener method provided by web3auth to check for token expiry ?

You can simply add it yourself…

// use [jwt-decode]( package to get the exp of id token.

setTimeout (() => {
// do something
}, exp)