Last active
February 22, 2017 02:06
-
-
Save ShankarSumanth/bf61e0cc570637126e918a271e689419 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| kc.isLoggedIn = function () { | |
| var promise = createPromise(); | |
| storage = new PersistentStorage(); | |
| if (!kc.responseMode) { | |
| kc.responseMode = 'fragment'; | |
| } | |
| if (!kc.responseType) { | |
| kc.responseType = 'code'; | |
| kc.flow = 'standard'; | |
| } | |
| var configPromise = loadConfig(config); | |
| configPromise.success(function () { | |
| checkIsLoggedIn(promise); | |
| }); | |
| //promise.setSuccess(true); | |
| return promise.promise; | |
| } | |
| kc.watchLogin = function () { | |
| setTimeout(checkLogin, loginIframe.interval * 1000); | |
| } | |
| function checkIsLoggedIn(promise) { | |
| setupCheckLoginIframe().success(function () { | |
| checkLoginIframe().success(function (loggedIn) { | |
| if (loggedIn) { | |
| var callback = parseCallback(window.location.href); | |
| if (!callback && !kc.token) { | |
| adapter = loadAdapter(); | |
| kc.login({}); | |
| } | |
| if (callback) { | |
| processCallback(callback, promise); | |
| } | |
| if (kc.token) | |
| setTimeout(checkLogin, loginIframe.interval * 1000); | |
| } | |
| }).error(function () { | |
| storage.removeItem('oauth'); | |
| promise.setSuccess(false); | |
| }); | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment