How long can the Internet Identity login status be maintained?

When I log in with Internet Identity, the ic-delegation and ic-identity will be saved in the browser’s local storage, but I found that they will be automatically cleared when I visit the website again after a while, and I need to log in again. What’s the matter? Is there a good way to increase the time of the login status so that I can automatically log in the next time I visit the website?

The application using II gets to pick the timeToLive for the delegation. It could ask the user how long they’d like their login to be valid.


Hi kritzcreek , thank you, I found the maxTimeToLive parameter.

      * Experiation of the authentication
     maxTimeToLive?: bigint;

Should I pass in milliseconds or a timestamp?
If I set maxTimeToLive to 10000 milliseconds, it will expire after 10000 milliseconds.
If I set my maxTimeToLive to a timestamp of 1629883636, it will expire after this time is reached.
Does this bigint represent milliseconds or timestamps?

The protocol is specified here: Internet Identity Spec

With the relevant section:

the maxTimeToLive , if present, indicates the desired time span (in nanoseconds) until the requested delegation should expire. The Identity Identity frontend is free to set an earlier expiry time, but should not create a larger.

1 Like