...
 
Commits (2)
...@@ -31,6 +31,12 @@ class SIBAuth extends HTMLElement { ...@@ -31,6 +31,12 @@ class SIBAuth extends HTMLElement {
if (await this.getUserWebId()) { if (await this.getUserWebId()) {
this.dispatchUserInfo(); this.dispatchUserInfo();
} }
const session = await new Promise(a => auth.trackSession(a));
if (!session) return;
const timeout = session.idClaims.exp * 1000 - Date.now();
setTimeout(() => {
this.logout();
}, timeout);
} }
/** @function /** @function
...@@ -219,7 +225,7 @@ class SIBAuth extends HTMLElement { ...@@ -219,7 +225,7 @@ class SIBAuth extends HTMLElement {
* @name login * @name login
* Try to login, if favorite provider is set, trigger login, if not, select provider * Try to login, if favorite provider is set, trigger login, if not, select provider
*/ */
async login() { login() {
const favoriteProvider = this.getFavoriteProvider(); const favoriteProvider = this.getFavoriteProvider();
if (favoriteProvider) { if (favoriteProvider) {
this.callProvider(favoriteProvider, 'login', this); this.callProvider(favoriteProvider, 'login', this);
......