sahat/satellizer — pull request #129 by kristofferahl (2014-09-24 13:23:35+00:00)
Title: Cross origin requests cause the stored token to be removed

When using satellizer I ran in to 2 issues when making cross origin requests.

1) Satellizer overrides the Authorization headers manually set by me before making the request
2) When a cross origin request returns a 401 status code, the satellizer interceptor causes the stored token to be removed.

I propose the following changes to be made.

1) Only set the Authorization header if the request is made to the same origin
2) Don't remove stored tokens if cross origin requests return a 401 status code

As $window is not available when running the config block I used window directly. I'm happy to provide a fix to this if there is one.

Any feedback is welcome!