# How long can the Internet Identity login status be maintained?

**URL:** <https://forum.dfinity.org/t/how-long-can-the-internet-identity-login-status-be-maintained/6273>\
**Category:** Developers\
**Created:** [August 3, 2021, 6:45am UTC](https://forum.dfinity.org/t/how-long-can-the-internet-identity-login-status-be-maintained/6273 "2021-08-03T06:45:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![HelloRickey](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/hellorickey/32/2020_2.png) [@HelloRickey](https://forum.dfinity.org/u/HelloRickey)\
**Post date:** [August 3, 2021, 6:45am UTC](https://forum.dfinity.org/t/how-long-can-the-internet-identity-login-status-be-maintained/6273/1 "2021-08-03T06:45:41Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![kritzcreek](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/kritzcreek/32/267_2.png) [@kritzcreek](https://forum.dfinity.org/u/kritzcreek)\
**Post date:** [August 3, 2021, 12:37pm UTC](https://forum.dfinity.org/t/how-long-can-the-internet-identity-login-status-be-maintained/6273/2 "2021-08-03T12:37:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![HelloRickey](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/hellorickey/32/2020_2.png) [@HelloRickey](https://forum.dfinity.org/u/HelloRickey)\
**Post date:** [August 25, 2021, 9:33am UTC](https://forum.dfinity.org/t/how-long-can-the-internet-identity-login-status-be-maintained/6273/3 "2021-08-25T09:33:52Z")

</div>

Hi [kritzcreek](https://forum.dfinity.org/u/kritzcreek) , thank you, I found the maxTimeToLive parameter.

```auto
     /**
      * 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?

---

<div class="post-metadata">

**Author:** ![kritzcreek](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/kritzcreek/32/267_2.png) [@kritzcreek](https://forum.dfinity.org/u/kritzcreek)\
**Post date:** [August 25, 2021, 11:52am UTC](https://forum.dfinity.org/t/how-long-can-the-internet-identity-login-status-be-maintained/6273/4 "2021-08-25T11:52:45Z")

</div>

The protocol is specified here: [Internet Identity Spec](https://github.com/dfinity/internet-identity/blob/713a8d8ec27fd0474f64bceb3571d8022cdd1455/docs/internet-identity-spec.adoc#client-authentication-protocol)

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.
