Skip to content

Instantly share code, notes, and snippets.

@thekarel
Created October 9, 2013 15:59
Show Gist options
  • Save thekarel/6903574 to your computer and use it in GitHub Desktop.
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/
// 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