Created
October 9, 2013 15:59
-
-
Save thekarel/6903574 to your computer and use it in GitHub Desktop.
Adding auth headers (username, password) to AngularJS $http methods -- From http://blog.tomaka17.com/2012/12/random-tricks-when-using-angularjs/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Base64 is not native, get a library or base64 outside of your script. | |
$http.defaults.headers.common['Authorization'] = 'Basic ' + Base64.encode($scope.login.login + ':' + $scope.login.password); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment