# Internet Identity idle-timeout

**URL:** <https://forum.dfinity.org/t/internet-identity-idle-timeout/38573>\
**Category:** Developers\
**Created:** [December 7, 2024, 2:35pm UTC](https://forum.dfinity.org/t/internet-identity-idle-timeout/38573 "2024-12-07T14:35:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rbole](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/rbole/32/1334_2.png) [@rbole](https://forum.dfinity.org/u/rbole)\
**Post date:** [December 7, 2024, 2:35pm UTC](https://forum.dfinity.org/t/internet-identity-idle-timeout/38573/1 "2024-12-07T14:35:33Z")

</div>

I want to extend the idle timeout of the II (Internet Identity) to 24 hours. Below is my attempt at implementing this functionality. However, despite my changes, the idle timeout still triggers after 30 minutes, resulting in an automatic logout.

I’m unsure about the correct settings. It also seems that idleTimeout is measured in milliseconds, while maxTimeToLive is measured in nanoseconds.

Does anyone know how to extend the time to 24 hours? Thanks so much for your help!

```auto
public async doLogin():Promise<UserExists | string> {
    const MILLISECONDS_IN_A_DAY = 1000 * 60 * 60 * 24;
    const NANOSECONDS_IN_A_DAY = BigInt(1000 * 60 * 60 * 24) * BigInt(1_000_000);
    // create an auth client
    let authClient = await AuthClient.create({
      idleOptions: {
        // in milliseconds
        idleTimeout: MILLISECONDS_IN_A_DAY,
      }
    });

    // start the login process and wait for it to finish
    return await new Promise((resolve, reject) => {
        authClient.login({
          // in nanoseconds
          maxTimeToLive: NANOSECONDS_IN_A_DAY,

          identityProvider: this.IIcanisterId,
          onSuccess: async () => {

            // create new actor with the identity
            this.actor = this.createActor({});

            // get user data
            const r = await this.getUserData();
            resolve(r ? r : "err2");
          },
          onError: (err:string | undefined) => {
            reject(err);
          },
        });
    });
  }

```

---

<div class="post-metadata">

**Author:** ![peterparker](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@peterparker](https://forum.dfinity.org/u/peterparker)\
**Post date:** [December 7, 2024, 3:57pm UTC](https://forum.dfinity.org/t/internet-identity-idle-timeout/38573/2 "2024-12-07T15:57:42Z")

</div>

I don’t know the answer but, to try debugging I would do the following:

- Be sure you logout-login again before making a test or use an incognito window
- Give a try fully disabling that idle stuffs

```auto
AuthClient.create({
		idleOptions: {
			disableIdle: true,
			disableDefaultIdleCallback: true
		}
	});

```

On a side note, it is advised not to create the `AuthClient` within the function that handles the login. Instead, declare it at a global level. If you don’t, the popup or tab opened for signing in to Internet Identity is likely to be blocked by Safari.

---

<div class="post-metadata">

**Author:** ![rbole](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/rbole/32/1334_2.png) [@rbole](https://forum.dfinity.org/u/rbole)\
**Post date:** [December 8, 2024, 9:54am UTC](https://forum.dfinity.org/t/internet-identity-idle-timeout/38573/3 "2024-12-08T09:54:30Z")

</div>

Thank you for the suggestion, but unfortunately, it didn’t have any effect. The system still logs out after 30 minutes.

---

<div class="post-metadata">

**Author:** ![rbole](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/rbole/32/1334_2.png) [@rbole](https://forum.dfinity.org/u/rbole)\
**Post date:** [December 9, 2024, 12:01pm UTC](https://forum.dfinity.org/t/internet-identity-idle-timeout/38573/4 "2024-12-09T12:01:33Z")

</div>

After gaining a better understanding of the Angular compiler cache, I believe it’s now working. I still need to test it further, but it seems I’ve successfully extended the login session to 24 hours.
