Basic Authentication for rest server


I’ve following for $http headers on angularjs documentation, but i never success when implementing in my program. by the way i’m using Basic authentication.
I put headers in config, here we go :smile:

.factory('authInterceptor', function($location, $q) {
  return {
    request: function(config) {

      config.headers = config.headers || {};

      config.headers.Authorization = "Basic "+ btoa("admin:1234");

      return config;

.config(function($stateProvider, $urlRouterProvider, $httpProvider, $translateProvider, localStorageServiceProvider) {



It’s should be sent Authorization headers every http request, but when i looking for it there is nothing.

This is the screenshot :smile:


Thank you in advance

Nope, But when i using POSTMAN it’s return success, it’s return error when i implemented in my program

Screenshot when using POSTMAN

Hi, I have the same problem. Did you solved it?

I fixed that by tricking my rest server (php) so i create another authentication not using authentication that has already like ‘basic’ or 'digest’
I just create another one