Advertisement
Guest User

Untitled

a guest
Dec 28th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         $scope.signIn = function () {
  2.             $scope.showMessage = false;
  3.             var params = "grant_type=password&username=" + $scope.username + "&password=" + $scope.password;
  4.             $http({
  5.                 url: '/Token',
  6.                 method: "POST",
  7.                 headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  8.                 data: params
  9.             })
  10.             .success(function (data, status, headers, config) {
  11.                 $http.defaults.headers.common.Authorization = "Bearer " + data.access_token;
  12.                 window.location = "/Dashboard#/";
  13.             })
  14.             .error(function (data, status, headers, config) {
  15.                 $scope.message = data.error_description.replace(/["']{1}/gi, "");
  16.                 $scope.showMessage = true;
  17.             });
  18.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement