title: Angular SPA adal login calls Azure AD and reply URL, but doesn't return userInfo or isAuthenticated
body: <p>I'm hoping to use Azure's Active Directory Service for authentication as part of an Angular SPA. To that end, I am trying to use <a href="https://github.com/AzureAD/azure-activedirectory-library-for-js" rel="nofollow noreferrer">Active Directory Authentication Library (ADAL) for JavaScript</a>. But while it seems to correctly redirect to login services and, after credential entry, returns to the Reply URL, I am not able to get userInfo.isAuthenticated (userInfo is empty) within my controller.</p>
  
  <p>How would I go about debugging why authentication doesn't appear to be finishing?</p>
  
  <p>The following is my app code:</p>
  
  <pre><code>'use strict';
  
  var myClientApplication = angular.module('myApplication', [
      'ngRoute', 'myControllerModule', 'AdalAngular'
  ]);
  
  Logging = {
      level: 3,
      log: function (message) {
          console.log(message);
      }
  };
  
  var appStart = function($routeProvider, $httpProvider, adalProvider) {
      $routeProvider.when('/xxx', {
          templateUrl: '/app/views/xxx.html',
          controller: 'xxxController',
          requireADLogin: true
      }).when('/home', {
          templateUrl: '/app/views/home.html',
          controller: 'homeController',
          requireADLogin: false
      }).otherwise({
          redirectTo: '/home'
      });
  
      adalProvider.init({
          instance: 'https://login.microsoftonline.com/',
          tenant: 'mydefaultdomain.onmicrosoft.com',
          clientId: '91dc4efa-xxxx-xxxx-xxxx-c579f5f07ceb',
          endPoints: {},
          //anonymousEndpoints: {},
          extraQueryParameter: 'nux=1',
          cacheLocation: 'localStorage',
      }, $httpProvider);
  };
  
  myClientApplication.config(['$routeProvider', '$httpProvider',  'adalAuthenticationServiceProvider', appStart]);
  </code></pre>
  
  <p>My controller code:</p>
  
  <pre><code>'use strict'
  
  var myControllerModule = angular.module('myControllerModule', []);
  
  myControllerModule.controller('homeController', ['$scope',   'adalAuthenticationService', function ($scope, adalService) {
      $scope.userInfo = adalService.userInfo;
      $scope.login = function() {
          adalService.login()
      }
      $scope.logout = function() {
          adalService.logOut()
      }
  }]);
  
  myControllerModule.controller('xxxController', ['$scope', function($scope){}]);
  </code></pre>
  
  <p>The view for the home controller is:</p>
  
  <pre><code>&lt;div class="container"&gt;
  &lt;button class="btn btn-primary" title="Login" ng-click="login()"&gt;Login&lt;/button&gt;
  &lt;button class="btn btn-primary" title="Logout" ng-click="logout()"&gt;Logout&lt;/button&gt;
  
  &lt;p&gt;status:{{userInfo.isAuthenticated}}&lt;/p&gt;
  &lt;p&gt;user:{{userInfo.userName}}&lt;/p&gt;
  &lt;p&gt;aud:{{userInfo.profile.aud}}&lt;/p&gt;
  &lt;p&gt;iss:{{userInfo.profile.iss}}&lt;/p&gt;
  </code></pre>
  
  <p></p>
  
  <p>Which results in:</p>
  
  <pre><code>status:false
  user:
  aud:
  iss:
  </code></pre>
  
  <p>Within Azure management, I have an Active Directory (Status=Active), with a defined Application with the following configuration:</p>
  
  <ul>
  <li>sign-on URL: <a href="http://127.0.0.1:8080/app/index.html" rel="nofollow noreferrer">http://127.0.0.1:8080/app/index.html</a></li>
  <li>client id: 91dc4efa-xxxx-xxxx-xxxx-c579f5f07ceb</li>
  <li>reply id: <a href="http://127.0.0.1:8080/app/index.html" rel="nofollow noreferrer">http://127.0.0.1:8080/app/index.html</a></li>
  </ul>
  
  <p>The following appears in the log messaging after login button press:</p>
  
  <pre><code>// I think this is coming to index
  app.js:10 Wed, 15 Feb 2017 22:45:09 GMT:1.0.13-VERBOSE: Location change event from http://127.0.0.1:8080/app/index.html#!#id_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJ…-4325-bcff-5bb5e5a552b9&amp;session_state=709884dd-ad85-4b58-b403-d3155ab441cc to http://127.0.0.1:8080/app/index.html#!#id_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJ…-4325-bcff-5bb5e5a552b9&amp;session_state=709884dd-ad85-4b58-b403-d3155ab441cc
  // I think this is the redirect for the home controller
  app.js:10 Wed, 15 Feb 2017 22:45:10 GMT:1.0.13-VERBOSE: Location change event from http://127.0.0.1:8080/app/index.html#!#id_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJ…-4325-bcff-5bb5e5a552b9&amp;session_state=709884dd-ad85-4b58-b403-d3155ab441cc to http://127.0.0.1:8080/app/index.html#!/home#id_token=eyJ0eXAiOiJKV1QiLCJhbG…-4325-bcff-5bb5e5a552b9&amp;session_state=709884dd-ad85-4b58-b403-d3155ab441cc
  // Don't know what this means?
  app.js:10 Wed, 15 Feb 2017 22:45:10 GMT:1.0.13-VERBOSE: Url: /app/views/home.html maps to resource: null
  </code></pre>
  
  <p>Versions:</p>
  
  <ul>
  <li>adal-angular: 1.0.13 </li>
  <li>angular: 1.6.2 </li>
  <li>node: 6.9.5 </li>
  <li>npm: 4.1.2 OS:</li>
  <li>Windows 10</li>
  </ul>
  
  <p>Running using 'npm start' where start=<a href="http://127.0.0.1:8080/../app.js" rel="nofollow noreferrer">http://127.0.0.1:8080/../app.js</a></p>