Skip to content

Commit f0fcda8

Browse files
author
Sachin Maheshwari
committed
correcting logic
1 parent d8e74f9 commit f0fcda8

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

web-assets/js/setupAuth0WithRedirect.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -428,14 +428,18 @@ const authSetup = function () {
428428
logger("inside auth0 block", "ok");
429429
auth0.isAuthenticated().then(function (isAuthenticated) {
430430
logger("inside auth0 block isAuthenticated", isAuthenticated);
431-
auth0.getTokenSilently().then(function (token) {
432-
logger("inside auth0 block getTokenSilently", token);
433-
storeToken();
434-
informIt(success, e);
435-
}).catch(function (err) {
436-
logger("receiveMessage: Error in refreshing through ifram token: ", err)
431+
if (isAuthenticated) {
432+
auth0.getTokenSilently().then(function (token) {
433+
logger("inside auth0 block getTokenSilently", token);
434+
storeToken();
435+
informIt(success, e);
436+
}).catch(function (err) {
437+
logger("receiveMessage: Error in refreshing through ifram token: ", err)
438+
informIt(failed, e);
439+
});
440+
} else {
437441
informIt(failed, e);
438-
});
442+
}
439443
}).catch(function (err) {
440444
logger("receiveMessage: Error occured in checkng authentication", err);
441445
informIt(failed, e);

0 commit comments

Comments
 (0)