401 unauthorized error with activity reorder by drag and drop feature
401 unauthorized error while reordering the activities by drag and drop feature
POST http://localhost:8080/api/v1/activities?x_key=623a00c1a8337755841ca9c9&access_token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJwYXJ0aWFsIjpmYWxzZSwiZXhwIjoxNjQ5MTAzMTU1OTg0fQ.EKcOL1VD-v6FSrMELDfBRoiLM9sDOiamDEUSTzwx_1A 401 (Unauthorized)
And because of that the progress is not getting saved
I would like to fix this issuealongside with issue #322 , as both are similar
I can't reproduce the issue on my side, could you detail your environment?
Closed due to lack of activity.
I just encountered a similar problem today when trying to re-arrange and limit the activities in the dashboard. It seemed like I was having issues with it not saving, but I didn't think to look in the console until I found this issue in the repo. Upon inspection, I was not getting a 401 - but connection refused.
I am connected to my server that is running on my network: http://10.0.0.11:8080
However, I noticed the error is actually being caused by the web app attempting to use the wrong URL - it is trying to use the API from http://localhost:8080!
I dug into the code a bit, and it appears that localhost is actually hard coded... https://github.com/llaske/sugarizer-server/blob/master/dashboard/helper/common.js#L103
Might I suggest either getting this info from window.location or adding a new ini configuration?
./dashboard/helper/commons.js
exports.getAPIUrl = function() {
return (ini.security.https ? 'https' : 'http' ) + "://" + ini.web.hostname + ":" + ini.web.port + '/';
};
./env/sugarizer.ini
[web]
hostname = 10.0.0.11
port = 8080
I did the above changes (adding new web.hostname ini configuration) and now I am able to modify the activities!
Good point @korgon :+1:
It's a bug. I can reproduce it on the dev platform where localhost is use too:
BTW I'm not sure about the cause, why it happens only on the activities screen? :thinking: