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!
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);
},
});
});
}