title: auth is undefined - ui-router & Auth0
body: <p>I'm using auth0 with ui-router. When the default route is loaded I can see the auth object is defined and contains methods. I get an undefined error when I try to access the value inside a controller. What's the best way of sharing this object with my controllers as as a reusable object? </p>
  
  <p>!-- controller </p>
  
  <pre><code>module.controller('login', ['$scope', function($scope,auth) {
  </code></pre>
  
  <p>!---  </p>
  
  <pre><code>}).run(function($rootScope, auth, store, jwtHelper, $state, $stateParams) {
  
      $rootScope.$on('$locationChangeStart', function() {
          if (!auth.isAuthenticated) {
              var token = store.get('token');
              if (token) {
                  if (!jwtHelper.isTokenExpired(token)) {
                      auth.authenticate(store.get('profile'), token);
                  } else {
                      $state.go('login');
                  }
              }
          }
  
      });
  
  });
  </code></pre>