Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sencha Touch 2 Ajax基本身份验证请求在Android上失败_Ajax_Webview_Cordova_Sencha Touch 2_Basic Authentication - Fatal编程技术网

Sencha Touch 2 Ajax基本身份验证请求在Android上失败

Sencha Touch 2 Ajax基本身份验证请求在Android上失败,ajax,webview,cordova,sencha-touch-2,basic-authentication,Ajax,Webview,Cordova,Sencha Touch 2,Basic Authentication,我有一个Sencha Touch 2.2.0应用程序包在Phonegap/Cordova 2.7.4中。它对使用HTTP基本身份验证的RESTAPI进行简单的ajax调用 Ext.Ajax.request({ url: 'http://localhost:3000/test', method: 'GET', // timeout occurs on invalid credentials? timeout: 2000, //enable basic au

我有一个Sencha Touch 2.2.0应用程序包在Phonegap/Cordova 2.7.4中。它对使用HTTP基本身份验证的RESTAPI进行简单的ajax调用

Ext.Ajax.request({
    url: 'http://localhost:3000/test',
    method: 'GET',

    // timeout occurs on invalid credentials?
    timeout: 2000,
    //enable basic authentication
    withCredentials: true,
    // need useDefaultXhrHeader: false and disableCaching: true to get cookies to work.
    useDefaultXhrHeader: false,
    disableCaching: true,

    username: 'username',
    password: 'password',
    success: function(response) {
        // process JSON data...

    },
    failure: function(response) {

        console.log('Login failed. response.status:' + response.status +
            ', response.statusText:' + response.statusText +
            ', response.responseText:' + response.responseText);

        // invalid credentials appears to timeout...
        // response.status:0, response.statusText:communications failure, response.responseText: undefined
    }
});
这段代码在iOS设备上可以正常工作,但在Android上不行

。。。D/CordovaLog 1967:登录失败。答复.现状:401, response.statusText:Unauthorized,response.responseText:Unauthorized

如果我在本地apache development web服务器上托管的默认android浏览器中运行此应用程序,则浏览器会提示我输入凭据。我怀疑ajax请求在等待凭据时超时。不管凭据是否正确,它是否可以在iOS上运行


有什么想法吗?

这个问题可能与webview有关。。。