Comments (14)
Have the same issue. Guys have you found any solution?
from angular-http-auth.
Hi guys, I am little of out scope right now, sorry for this, but may I suggest you look at the code of http-auth-interceptor to find answers for your questions? It's all just few lines of code in one file.
from angular-http-auth.
Hi
I have looked, but I'm not familiar with how AngularJS deals with all this internally, (and I'm still kinda new to js). Didn't find any clues first look. I can look again, but don't think I will get any further. Any hints for what it can be?
from angular-http-auth.
Hi guys!
I have looked at the code of http-auth-interceptor and I think that the problem is on
ng-file-upload side
https://github.com/danialfarid/ng-file-upload/blob/master/dist/ng-file-upload.js
If i comment out lines 66-83 it fixes the issue
from angular-http-auth.
IMHO here is buggy code
if (window.XMLHttpRequest && !(window.FileAPI && FileAPI.shouldLoad)) {
window.XMLHttpRequest.prototype.setRequestHeader = (function (orig) {
return function (header, value) {
if (header === '__setXHR_') {
var val = value(this);
// fix for angular < 1.2.0
if (val instanceof Function) {
val(this);
}
} else {
orig.apply(this, arguments);
}
};
})(window.XMLHttpRequest.prototype.setRequestHeader);
}
and
config.headers.__setXHR_ = function () {
return function (xhr) {
if (!xhr) return;
config.__XHR = xhr;
if (config.xhrFn) config.xhrFn(xhr);
xhr.upload.addEventListener('progress', function (e) {
e.config = config;
notifyProgress(getNotifyEvent(e));
}, false);
//fix for firefox not firing upload progress end, also IE8-9
xhr.upload.addEventListener('load', function (e) {
if (e.lengthComputable) {
e.config = config;
notifyProgress(getNotifyEvent(e));
}
}, false);
};
};
Now i'm going to create new issue on ng-file-upload git
from angular-http-auth.
Nice find 👍
from angular-http-auth.
@alex-training that's how the plugin listen to the progress event if you remove those lines file progress feature will be removed too
from angular-http-auth.
If you guys can create a small jsfiddle showing the error I can debug it and find out where the issue is.
You can POST to this url to simulate 401 error: https://angular-file-upload-cors-srv.appspot.com/upload?errorCode=401&errorMessage=error
from angular-http-auth.
@danialfarid
Unfortunately I understand that the feature will be removed too...
OK, I will create jsfiddle project to reproduce this behavior
from angular-http-auth.
Guys please have a look at jsfiddle
https://jsfiddle.net/alexedu/4na60fpd/
You can see all errors in browser console
from angular-http-auth.
Thanks @alex-training for making the jsfiddle. I have nothing to add, this is the one :)
from angular-http-auth.
This is fixed at ng-file-upload#8.0.4, you can close this issue now.
from angular-http-auth.
Very nice! Thank you @danialfarid for the quick fix!
from angular-http-auth.
Thank you @danialfarid
from angular-http-auth.
Related Issues (20)
- Breaks angular-loading-bar HOT 7
- doesn't seem to use the config for the next requests HOT 4
- bower install warning HOT 7
- There is no minified version on bower/npm HOT 5
- resume loading screen HOT 3
- login address returns 404 after 401 intercept HOT 2
- Error when config doesn't exist HOT 1
- Even Unauthenticated user can see static contents of the page HOT 5
- Add Trip distance
- How angular-http-auth-buffer works ? HOT 2
- npm version stuck on 1.2.1 HOT 2
- Prevent double event HOT 1
- Basic authentication results in 404 HOT 4
- no 'event:auth-loginRequired' since 1.3.0 HOT 6
- Scenario with refresh token (e.g. authService.ignoreCurrentRequest()) HOT 3
- Add Better loginCancelled documentation to avoid confusion HOT 1
- Please add license = "MIT" to bower.son HOT 2
- Even't function won't fire HOT 6
- Interceptor automatically captures all 401s and prevents other interceptors from having an opportunity to examine them
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-http-auth.