mr_malee Posted September 23, 2014 Share Posted September 23, 2014 Hi, seems after the latest Chrome update, images are failing to load due to an Authorization error. http://stackoverflow.com/questions/19244006/chrome-basic-auth-image-requests-return-401-but-not-when-called-directly Anyone know how I can get around this? Loading an image directly works, but then how to add that information, along with the atlas into pixi? Quote Link to comment Share on other sites More sharing options...
dirkk0 Posted September 24, 2014 Share Posted September 24, 2014 Why would you do basic authentication on your images in the first place? Quote Link to comment Share on other sites More sharing options...
chg Posted September 24, 2014 Share Posted September 24, 2014 Why would you need this? Supposing you have some really good reason which I can not fathom; could you send the auth with some other request and then load the images relying on the browser to continue using the already established session? Quote Link to comment Share on other sites More sharing options...
mr_malee Posted September 24, 2014 Author Share Posted September 24, 2014 the site is password protected not the images. After supplying the correct username and password the site loads. Using pixi AssetLoader and adding a .json atlas file to it, once pixi starts trying to load the png defined in that .json, I get the 401 Authentication error.So far this has only happened in Chrome and IE. Firefox and Safair work. Quote Link to comment Share on other sites More sharing options...
Squize Posted November 26, 2014 Share Posted November 26, 2014 Hey Mr. M, small small world. I've got exactly the same issue, anyone got any pointers for this ? I've heard talk of XMLHttpRequest and setRequestHeaders, but that's the full extent of my knowledge on this. Cheers, Squize. Quote Link to comment Share on other sites More sharing options...
GrindheadGames Posted November 27, 2014 Share Posted November 27, 2014 Ok i think I have a solution to the problem. You need to set game.load.crossOrigin = 'use-credentials' You also need to edit the xhrLoad method within loader.js and add the line this._xhr.withCredentials = true; This will ensure that the request headers are updated with the correct authentication. Info found from here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS Squize 1 Quote Link to comment Share on other sites More sharing options...
GrindheadGames Posted November 27, 2014 Share Posted November 27, 2014 To make it clear I fixed this issue in a game that uses Phaser, not just Pixi.js but i'm sure it will be useful Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.