# Basic Authentication for rest server

**URL:** <https://forum.ionicframework.com/t/basic-authentication-for-rest-server/13847>\
**Category:** ionic-v1\
**Created:** [December 10, 2014, 5:05am UTC](https://forum.ionicframework.com/t/basic-authentication-for-rest-server/13847 "2014-12-10T05:05:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![donny](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/donny/32/7539_2.png) [@donny](https://forum.ionicframework.com/u/donny)\
**Post date:** [December 10, 2014, 5:05am UTC](https://forum.ionicframework.com/t/basic-authentication-for-rest-server/13847/1 "2014-12-10T05:05:55Z")

</div>

Hello,

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 😄

```
.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) {

  $httpProvider.interceptors.push('authInterceptor');

})

```

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

This is the screenshot 😄  
 ![](https://sea1.discourse-cdn.com/ionicframework/uploads/default/7714/ee252c89bc5df1d2.png)

Sincerely,

Thank you in advance

---

<div class="post-metadata">

**Author:** ![donny](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/donny/32/7539_2.png) [@donny](https://forum.ionicframework.com/u/donny)\
**Post date:** [December 10, 2014, 7:47am UTC](https://forum.ionicframework.com/t/basic-authentication-for-rest-server/13847/2 "2014-12-10T07:47:00Z")

</div>

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

Screenshot when using POSTMAN  
 ![](https://sea1.discourse-cdn.com/ionicframework/uploads/default/7718/d837f66fdc1428d7.png)

---

<div class="post-metadata">

**Author:** ![remix86](https://avatars.discourse-cdn.com/v4/letter/r/b2d939/32.png) [@remix86](https://forum.ionicframework.com/u/remix86)\
**Post date:** [February 7, 2015, 5:08pm UTC](https://forum.ionicframework.com/t/basic-authentication-for-rest-server/13847/3 "2015-02-07T17:08:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![donny](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/donny/32/7539_2.png) [@donny](https://forum.ionicframework.com/u/donny)\
**Post date:** [February 7, 2015, 5:26pm UTC](https://forum.ionicframework.com/t/basic-authentication-for-rest-server/13847/4 "2015-02-07T17:26:58Z")

</div>

Hi,  
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
