title: How to change Satellizer's $authProvider.loginUrl inside an Angular controller?
body: <p>Here's my case scenario:</p>
  
  <ol>
  <li>User is not logged in, and they try to access a /settings page. </li>
  <li>My Settings controller recognizes based on <code>$auth.isAuthenticated() != true</code> that they aren't logged in, and redirects them to /login</li>
  <li>User fills out their email and password and hits submit. </li>
  </ol>
  
  <p>What I would <em>like</em> to do on this third step is then redirect them to the /settings page, not the home page. </p>
  
  <p>I'm thinking I would be changing this variable: </p>
  
  <p><code>$authProvider.loginRedirect = '/';</code></p>
  
  <p>The problem is that I cannot include <code>$authProvider</code> in my <code>loginCtrl.js</code> file without getting an "unknown provider" error in my console: <a href="https://docs.angularjs.org/error/">https://docs.angularjs.org/error/</a>$injector/unpr?p0= In other words, Angular does not recognize <code>$authProvider</code> when I try to include it. Here's what my <code>loginCtrl.js</code> file looks like:</p>
  
  <pre><code>/* Everything is blowing up because I'm trying to include $authProvider */
  angular.module("PrayerChain")
      .controller("loginCtrl", ["$rootScope", "$scope", "$state", "$http", "$auth", "$authProvider", loginCtrl]);
  
  function loginCtrl($rootScope, $scope, $state, $http, $auth, $authProvider) {
      $authProvider.loginRedirect = '/settings';
      $scope.login = function () {
          $auth.login({ Email: $scope.email, Password: $scope.password })
          .then(function() {
  
          })
          .catch(function (response, status, headers) {
              console.log(response);
              $scope.error = JSON.parse(response.data);
          });
      };
  }
  </code></pre>
  
  <p>Is including <code>$authProvider</code> in a controller even possible? If not, what's an alternative solution to changing where people are redirected upon logging in using Satellizer? </p>
  
  <p>Thanks.</p>