webdis icon indicating copy to clipboard operation
webdis copied to clipboard

Q: Basic_authentication cannot use with http://user:[email protected]:7379/command

Open ukrit-himakoon opened this issue 11 years ago • 5 comments

Hello I tried to configured acl in webis.json as follows: "acl": [ { "disabled": ["*"] },

            {
                    "http_basic_auth":      "user:password",
                    "enabled":              ["SET"]
            }

]

I can use curl -u user:password to execute "SET" command. Unfortunately, ACL does not work when I input URL to chrome browser: http://user:[email protected]/set/key/1 , I always get 403 forbidden.

Any suggestion for this? Please note that I am using the the released version 0.1

Thanks,

ukrit-himakoon avatar Oct 28 '13 12:10 ukrit-himakoon

Hello any answer for this?

ukrit-himakoon avatar Nov 15 '13 09:11 ukrit-himakoon

I am seeing the same issue. I don't think wedbis is asking the browser to authenticate the user. curl sends the token with the request -- the browser sends the request and webdis simply says 403.

digitalrinaldo avatar Dec 03 '13 17:12 digitalrinaldo

Hello,

Using Chrome with the inspector, I can't see any Basic Auth data being sent: Chrome inspector

Am I missing something? How should this be sent?

nicolasff avatar Dec 03 '13 22:12 nicolasff

I'm not exactly sure why this isn't working for you, but the solution is this:

var token = btoa(user+':'+pass)
var header = 'Basic: ' + token;

Add the header variable to the XHR request under the Authorization header.

If you're just trying to test your implementation, try using Postman. It will automatically add the header for you if you add a username and password to the request. Otherwise, you'll have to do the base64 encoding yourself.

adamgoose avatar Aug 22 '14 16:08 adamgoose

Browser expects a 401, which webdis does not sent. It responds immediately with 403. Curl, on the other hand, sends "Authentication: Basic ####" headers right away.. If you want to talk to webdis from JavaScript, just make sure to send the appropriate headers right away.

anapsix avatar Jul 02 '15 20:07 anapsix