diff --git a/app.js b/app.js index b495006..342d4a9 100644 --- a/app.js +++ b/app.js @@ -14,6 +14,7 @@ function init() { document.getElementById('email-form').style.display = 'none'; document.getElementById('dj-set-form').style.display = 'block'; loadGenres(); // Load genres when the user is authenticated + tokenExpire(redirectUri); } else { document.getElementById('login-button').style.display = 'block'; document.getElementById('email-form').style.display = 'block'; @@ -21,6 +22,13 @@ function init() { } } +function tokenExpire(url) { + // 3600 seconds = 3600 * 1000 milliseconds + setTimeout(function() { + window.location.href = url; + }, 3600 * 1000); +} + function authenticate() { const scopes = 'user-read-private user-read-email playlist-modify-private'; window.location = `https://accounts.spotify.com/authorize?client_id=${clientId}&response_type=token&redirect_uri=${encodeURIComponent(redirectUri)}&scope=${encodeURIComponent(scopes)}`;