diff --git a/js/app.js b/js/app.js index 28196db..f8da0cf 100644 --- a/js/app.js +++ b/js/app.js @@ -117,21 +117,26 @@ app.run(['$rootScope', '$state', 'Auth', '$location', function($rootScope, $stat $rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) { var requiresLogin = toState.data.requiresLogin; toState.data.session = $location.search(); + var urlParams = $location.search(); + console.log('DUDDDDDDDEEEEEE ->', urlParams); $rootScope.redirectedURL = toState.url; $rootScope.urlArray.push($rootScope.redirectedURL); if ($rootScope.urlArray.length > 1) { $rootScope.redirectedURL = $rootScope.urlArray[0]; $rootScope.urlArray = []; } - +console.log('stuff here ->', toState); if (requiresLogin && !Auth.isLoggedIn()) { event.preventDefault(); console.log('stuff here ->', toState); if (!angular.equals(toState.data.session, {})) { var sess = toState.data.session.access_token; console.log('WHERE', $rootScope.redirectedURL ); + // $state.go("app." + $rootScope.redirectedURL); + } + if ('access_token' in urlParams && 'refresh_token' in urlParams && 'issuer' in urlParams && 'audience' in urlParams) { Auth.add(sess) - $state.go("app." + $rootScope.redirectedURL); + console.log('da '); } console.log('WHERE', $rootScope.redirectedURL ); $state.go('splash-page', { 'toState': toState.name }); diff --git a/js/controllers/login-controller.js b/js/controllers/login-controller.js index 2e13dde..0ca7d7e 100644 --- a/js/controllers/login-controller.js +++ b/js/controllers/login-controller.js @@ -102,6 +102,11 @@ app.controller('loginCtrl', [ subject: subject , scope: [ 'domains@oauth3.org', 'domains', 'dns@oauth3.org', 'dns', 'www@daplie.com' ] }).then(function (session) { + console.log('SESSION BRO -> ', session); + console.log('SESSION TOKEN -> ', session.token); + console.log('SESSION REFRESH TOKEN -> ', session.refresh); + console.log('SESSION ISSUER -> ', session.token.iss); + console.log('SESSION AUDIENCE -> ', session.token.aud); session.subject = subject; session.issuer = issuer; Auth.add(session);