diff --git a/js/app.js b/js/app.js index 7649ed4..01955c0 100644 --- a/js/app.js +++ b/js/app.js @@ -126,17 +126,15 @@ app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $stat // } if (requiresLogin && !Auth.isLoggedIn()) { event.preventDefault(); - toState.data.session.token = OAUTH3.jwt.decode(query.access_token); - toState.data.session.refresh = OAUTH3.jwt.decode(query.refresh_token); if (!angular.equals(toState.data.session, {})) { - // if ('access_token' in urlParams && 'refresh_token' in urlParams && 'issuer' in urlParams && 'audience' in urlParams) { - Auth.add(query); - console.log('go here', $rootScope.redirectedURL); - $state.go('app.'+$rootScope.redirectedURL) - // $location.path($rootScope.redirectedURL); - // } + toState.data.session.token = OAUTH3.jwt.decode(query.access_token); + toState.data.session.refresh = OAUTH3.jwt.decode(query.refresh_token); + Auth.add(query); + console.log('go here', $rootScope.redirectedURL); + $state.go('app.' + $rootScope.redirectedURL); + } else { + $state.go('splash-page', { 'toState': toState.name }); } - // $state.go('splash-page', { 'toState': toState.name }); } }); }]);