Using Authentication with Ajax.Request

后端 未结 2 1603
感动是毒
感动是毒 2020-12-18 13:27

I currently have a Palm WebOS application that uses an Ajax.Request to connect to a web service using basic authentication. To send the username and password, I simply inclu

相关标签:
2条回答
  • 2020-12-18 13:41

    You could try to encode the user name and password before they get sent using encodeURIComponent.

    More generally though, have you tested this method in IE8? Because it doesn't work for normal requests any more - the username:password@ scheme has been disabled there for security reasons.

    It could be, though, that they are still allowed in Ajax requests.

    0 讨论(0)
  • 2020-12-18 13:49

    Send the Basic authentication info with header: http://coderseye.com/2007/how-to-do-http-basic-auth-in-ajax.html

    var auth = 'Basic ' + Base64.encode(user + ':' + pass);
    Ext.Ajax.request({
        url : url,
        method : 'GET',
        headers : { Authorization : auth }
    });
    
    0 讨论(0)
提交回复
热议问题