PhoneGap的+煎茶+安卓与failled一个基本的接入认证Ajax请求 [英] Phonegap + Sencha + Android : ajax request with a basic access authentication failled

查看:175
本文介绍了PhoneGap的+煎茶+安卓与failled一个基本的接入认证Ajax请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的乡亲,

我工作的一个PhoneGap的应用程序和煎茶框架。

I'm working on a Phonegap application and the Sencha framework.

我试图达成一个受保护的服务器但与Android验证失败(但不与iOS)。我用下面的code:

I try to reach a protected server but the authentication failed with Android (but not with iOS). I use the code below :

    Ext.Ajax.request({
        url:"http://user:password@api.website.fr/query.json",
        method: 'GET',
        // I tried to send the header directly but it didn't work too
        headers: {
            "Authorization": "Basic s2dh3qs76jd2hqjsdh=="  
        },        
        success: function (result, request) {                 
            alert(result);
        },
        failure: function ( result, request) {            
            for(var key in result)
                alert(result[key]);
        } 
    });

该错误消息说,我说,一个HTTP摘要需...

The error message says me that an HTTP digest is required...

只知道:


  • 互联网联接细

  • 同样code可与本地文件和其他外部的API

  • 我不知道如何探索在LogCat中的Javascript对象,以便原谅我恶心警报(结果[关键])

  • Internet connexion is fine
  • The same code works with a local file and other external APIs
  • I don't know how to explore Javascript objects in the LogCat so excuse my disgusting alert(result[key])

感谢你们,你们都摇滚乐!

Thank you guys, you all rock!

推荐答案

我同意@Mariano。你为什么不能尝试在浏览器中,然后部署与PhoneGap的应用程序。跨域问题可以通过启动谷歌浏览器从终端通过这个命令来解决
谷歌铬--args --disable-Web的安全

I agree with @Mariano. Why can't you try it in the browser and then deploy as an app with phonegap. The cross-domain problem can be solved by starting google chrome from the terminal by this command google-chrome --args --disable-web-security

看看这个链接获取更多信息。

Check out this link for more information

http://www.senchatouchbits.com/7/cross-域的Ajax-requests.html

这篇关于PhoneGap的+煎茶+安卓与failled一个基本的接入认证Ajax请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆