colinskow / ng-superlogin

AngularJS bindings for the SuperLogin project
MIT License
15 stars 17 forks source link

replaced superloginInterceptor with slApi factory #13

Closed gregvis closed 8 years ago

gregvis commented 8 years ago

didn't like that superlogin was intercepting every $http request in my application. I wrapped the superlogin $http calls in a slApi factory to replicate the interceptor functionality

colinskow commented 8 years ago

The entire point of ng-superlogin is that it intercepts $http requests through Angular to automatically add authentication headers to any request going to the domains you configured. This allows developers to automatically add authentication headers to API requests. If you don't like that functionality, just disable it in the config.

gregvis commented 8 years ago

My issue is, there is no way to completely disable it...the interceptor is activated even if you don't use it. It adds needless processing. I'll admit that it's not a lot, but it can add up.

Look at my app start up (these are my angular templates):

image

My config has: endpoints = [], noDefaultEndpoint = true.

colinskow commented 8 years ago

It is checking a simple if statement on every request to check if the domain matches a registered endpoint. Your app would have to be doing thousands of requests per second for this to have any noticeable impact on performance. The requests are the bottleneck, not the interceptor.

If you really want to improve the performance of your app then try caching all your templates to eliminate all those requests altogether.

I would accept your solution if it didn't remove the core functionality of ng-superlogin. Angular really is more about developer convenience than efficiency.