From 9beb210c23d576a38203998097198c09dea3e457 Mon Sep 17 00:00:00 2001 From: mposolda Date: Wed, 18 Jun 2014 18:08:05 +0200 Subject: [PATCH] fix javascript error when click on 'Show Expires' and token is not active --- examples/js-console/src/main/webapp/index.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/js-console/src/main/webapp/index.html b/examples/js-console/src/main/webapp/index.html index 468dfaeb9b..b0cbf3987d 100644 --- a/examples/js-console/src/main/webapp/index.html +++ b/examples/js-console/src/main/webapp/index.html @@ -48,6 +48,11 @@ } function showExpires() { + if (!keycloak.tokenParsed) { + output("Not authenticated"); + return; + } + var o = 'Token Expires:\t\t' + new Date(keycloak.tokenParsed.exp * 1000).toLocaleString() + '\n'; o += 'Token Expires in:\t' + Math.round(keycloak.tokenParsed.exp - new Date().getTime() / 1000) + ' seconds\n';