# Clarity on the maxTimeToLive passed in authClient for Internet Identity

**URL:** <https://forum.dfinity.org/t/clarity-on-the-maxtimetolive-passed-in-authclient-for-internet-identity/13493>\
**Category:** internet-identity\
**Created:** [June 4, 2022, 7:43am UTC](https://forum.dfinity.org/t/clarity-on-the-maxtimetolive-passed-in-authclient-for-internet-identity/13493 "2022-06-04T07:43:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![saikatdas0790](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/saikatdas0790/32/17147_2.png) [@saikatdas0790](https://forum.dfinity.org/u/saikatdas0790)\
**Post date:** [June 4, 2022, 7:43am UTC](https://forum.dfinity.org/t/clarity-on-the-maxtimetolive-passed-in-authclient-for-internet-identity/13493/1 "2022-06-04T07:43:17Z")

</div>

The documentation here talks about `DelegationIdentity`being valid with the set `maxTimeToLive`.

> **[@dfinity/auth-client](https://www.npmjs.com/package/@dfinity/auth-client)**
>
> JavaScript and TypeScript library to provide a simple integration with an IC Internet Identity. Latest version: 0.11.3, last published: a day ago. Start using @dfinity/auth-client in your project by running \`npm i @dfinity/auth-client\`. There are 11...

 ![image](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/f/f15328551992036d978fa02aaba9cc1093fb8ae7.png)

The II interface spec too talks about it here

> **[The Internet Identity Specification | Internet Computer Home](https://internetcomputer.org/docs/current/references/ii-spec/#client-auth-protocol)**
>
> theinternetidentityspecification}

 ![image](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/6/6e3f4866f4a588e68513f4ec032d99b327131e5b.png)

The questions I have are:

- What is the default value in case nothing is passed?
- Is there a way to obtain a `DelegationIdentity` that doesn’t expire?
- What is the exact max value that can be passed?

---

<div class="post-metadata">

**Author:** ![paulyoung](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/paulyoung/32/5251_2.png) [@paulyoung](https://forum.dfinity.org/u/paulyoung)\
**Post date:** [June 5, 2022, 6:52am UTC](https://forum.dfinity.org/t/clarity-on-the-maxtimetolive-passed-in-authclient-for-internet-identity/13493/2 "2022-06-05T06:52:18Z")

</div>

> [@saikatdas0790](#):
>
> What is the default value in case nothing is passed?

This says 8 hours:

> <https://github.com/dfinity/agent-js/blob/03515b4753c82694103606713deb543250b50b32/packages/auth-client/src/index.ts#L69-L73>

> <https://github.com/dfinity/agent-js/blob/03515b4753c82694103606713deb543250b50b32/packages/auth-client/src/index.ts#L376-L380>

> <https://github.com/dfinity/agent-js/blob/03515b4753c82694103606713deb543250b50b32/packages/auth-client/src/index.ts#L403-L404>

But I’ve been getting logged out after about 30 minutes:

> <https://github.com/dfinity/agent-js/issues/576>
>
> \*\*Describe the bug\*\*
> 
> During local development I noticed that I was getting lo…gged out after iterating on something for a while that requires being logged in.
> 
> I started doing \`AuthClient.create({ idleOptions: { disableIdle: true })\` to try and prevent this but it's still happening. I stepped through the code and I can confirm that an \`idleManager\` isn't being created.
> 
> Is this expected behavior, or a known issue?
> 
> \*\*To Reproduce\*\*
> Steps to reproduce the behavior:
> 
> 1. Create an auth client as described above
> 1. Authenticate using local internet identity
> 1. Leave a browser window open for a while
> 1. Refresh the page after a while
> 1. Confirm that you are logged out
> 
> \*\*Expected behavior\*\*
> You remain logged in until you explicitly log out
> 
> \*\*Desktop (please complete the following information):\*\*
> 
> \- macOS Monterey Version 12.2.1 (21D62)
> \- Brave Version 1.36.119 Chromium: 99.0.4844.83 (Official Build) (arm64)
> 
> \*\*Additional context\*\*
> 
> \`\`\`
> $ cat package-lock.json | grep dfinity
> "@dfinity/agent": {
> "resolved": "https://registry.npmjs.org/@dfinity/agent/-/agent-0.11.1.tgz",
> "@dfinity/auth-client": {
> "resolved": "https://registry.npmjs.org/@dfinity/auth-client/-/auth-client-0.11.1.tgz",
> "@dfinity/authentication": {
> "resolved": "https://registry.npmjs.org/@dfinity/authentication/-/authentication-0.11.1.tgz",
> "@dfinity/candid": {
> "resolved": "https://registry.npmjs.org/@dfinity/candid/-/candid-0.11.1.tgz",
> "@dfinity/identity": {
> "resolved": "https://registry.npmjs.org/@dfinity/identity/-/identity-0.11.1.tgz",
> "@dfinity/principal": {
> "resolved": "https://registry.npmjs.org/@dfinity/principal/-/principal-0.11.1.tgz",
> \`\`\`

* * *

> [@saikatdas0790](#):
>
> Is there a way to obtain a `DelegationIdentity` that doesn’t expire?

I would like to know this too.

* * *

> [@saikatdas0790](#):
>
> What is the exact max value that can be passed?

`BigInt`s are supposed to be arbitrarily large but in practice it seems to be implementation-specific:

> <https://github.com/tc39/proposal-bigint/issues/174>
>
> I happened to notice that chrome happens to throw when the result of a BigInt ar…ithmetic operation is too large. Is the exact maximal value specified/documented/available anywhere? (And does anyone else think that needing to wrap all my arithmetic in try/catch blocks to handle out of range exceptions is gratuitious compared to how arithmetic overflow is handled for normal numbers?)

[javascript - What's the biggest BigInt value in js as per spec - Stack Overflow](https://stackoverflow.com/questions/53335545/whats-the-biggest-bigint-value-in-js-as-per-spec)

---

<div class="post-metadata">

**Author:** ![saikatdas0790](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/saikatdas0790/32/17147_2.png) [@saikatdas0790](https://forum.dfinity.org/u/saikatdas0790)\
**Post date:** [June 6, 2022, 3:45am UTC](https://forum.dfinity.org/t/clarity-on-the-maxtimetolive-passed-in-authclient-for-internet-identity/13493/3 "2022-06-06T03:45:50Z")

</div>

Right, my use case is primarily syncing data between devices, so I am primarily looking for a way to have auth never expire. In case it absolutely has to, I am looking for the maximum possible value that the IC supports. I was reading on [this thread](https://forum.dfinity.org/t/specified-sender-delegation-has-expired/6208/2) that it’s close to 8 days, but knowing the EXACT maximum value that is practically possible would be helpful

@anon74414410 @PaulLiu Any thoughts?

---

<div class="post-metadata">

**Author:** ![frederikrothenberger](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/frederikrothenberger/32/3826_2.png) [@frederikrothenberger](https://forum.dfinity.org/u/frederikrothenberger)\
**Post date:** [June 7, 2022, 7:28am UTC](https://forum.dfinity.org/t/clarity-on-the-maxtimetolive-passed-in-authclient-for-internet-identity/13493/4 "2022-06-07T07:28:29Z")

</div>

@saikatdas0790: The exact maximum value has been increased to `30 days`.

We are aware, that there are many use cases for which delegations without expiry would be helpful. However, these are problematic from a security perspective. So what we will most likely implement in the future are short-lived delegations that can be refreshed.

Unfortunately though, this is only a plan so far and I cannot give you a timeline of when this feature will be ready. The most up to date information can be found here: [Internet Identity Roadmap Update, June 2022](https://forum.dfinity.org/t/internet-identity-roadmap-update-june-2022/13430)

---

<div class="post-metadata">

**Author:** ![saikatdas0790](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/saikatdas0790/32/17147_2.png) [@saikatdas0790](https://forum.dfinity.org/u/saikatdas0790)\
**Post date:** [June 7, 2022, 10:22am UTC](https://forum.dfinity.org/t/clarity-on-the-maxtimetolive-passed-in-authclient-for-internet-identity/13493/5 "2022-06-07T10:22:22Z")

</div>

Thank you for the clarity. 30 days will work for now

---

<div class="post-metadata">

**Author:** ![anon74414410](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@anon74414410](https://forum.dfinity.org/u/anon74414410)\
**Post date:** [June 13, 2022, 8:42pm UTC](https://forum.dfinity.org/t/clarity-on-the-maxtimetolive-passed-in-authclient-for-internet-identity/13493/6 "2022-06-13T20:42:29Z")

</div>

Additionally, for long-term usage you can use identities that are not delegated at all, although this requires you to securely save the public-private keypair
