Id_token and access_token are not getting at a time using javascript

HI, I am using implicit flow with okta sign-in widget using javascript.

Here is my code, Please help me what I am missing here:
Signin page code:
var oktaSignIn = new OktaSignIn({
baseUrl: ‘https://example.com’,
features: {
idpDiscovery: true
},
idpDiscovery:{
requestContext: window.location.href
},
clientId: ‘0oGTF56fdd8Hcfd’,
authParams: {
issuer: ‘https://example.com/oauth2/hyyf5Rkk76FDRXyfc’,
responseType: [‘token’, ‘id_token’],
scopes: [‘openid’, ‘profile’, ‘email’],
display: ‘page’
}
});

Page redirects to home.html after signing in :
there I am trying to get access_token and id_token using authClient:
home.html code:
var id_token = “”;
var accessToken = “”;
var email = “”;
var authClient = new OktaAuth({
url: ‘https://example.com’,
issuer: ‘https:/example.com/oauth2/hyyf5Rkk76FDRXyfc’,
// OpenID Connect APP Client ID
clientId: ‘0oGTF56fdd8Hcfd’,
redirectUri: ‘http://invApp.com/home.html’,
responseType: [‘id_token,token’],
tokenManager: {
storage: ‘sessionStorage’,
autoRenew: false,
secure: true
}
});
// Note, this requires an active user session in Okta.
setInterval(function() {
authClient.session.exists().then(exists => {
if (!exists) {
alert(“Session doesn’t exist.Please login again!”);
window.location = “login.html”;
}
}).catch(() => {
console.log(“error checking session”);
});
}, 5000);
// Attempt to retrieve ID Token from Token Manager
var idToken = authClient.tokenManager.get(‘idToken’)
.then(idToken => {
// If ID Token exists, output it to the console
if (idToken) {
if(email=="") {
email = idToken.claims.email;
("#email").text(email); } // If ID Token isn't found, try to parse it from the current URL authClient.tokenManager.add('idToken', idToken); accessToken = idToken.accessToken; id_token = idToken.idToken; } else if (location.hash) { authClient.token.parseFromUrl() .then(idToken => { if(email=="") { email = idToken.claims.email; ("#email").text(email);
}
// Store parsed token in Token Manager
var str = JSON.stringify(idToken);
console.log(“str” + str);
authClient.tokenManager.add(‘idToken’, idToken);
window.localStorage.setItem(‘access_token’, idToken.accessToken);
window.localStorage.setItem(‘id_token’, idToken.idToken);
window.localStorage.setItem(‘email’, email);
accessToken = idToken.accessToken;
id_token = idToken.idToken;
});
}
else {
// You’re not logged in, you need a sessionToken
authClient.token.getWithRedirect({
responseType: [‘token’, ‘id_token’]
});
/* authClient.token.getWithRedirect({
responseType: ‘token’
}); */
//alert(“You’re not logged in, please login”);
}
});