发现凌空错误没有认证的挑战 - 机器人 [英] android - volley error No authentication challenges found

查看:158
本文介绍了发现凌空错误没有认证的挑战 - 机器人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用一些旧的code工作,并利用截击时遇到了一个问题。

I am trying to work with some legacy code and have come up against an issue when using volley.

我试图去,我们的主要站点有一个API,它工作正常的一个帐户,而不是其他。我试图找出什么样的差异可能是在请求URL /头,也是什么回来的反应,但我似乎无法找到凌空code的方式来打印这对登录。

I am trying to get to an api that our main site has and it works fine for one account, but not another. I'm trying to work out what the differences might be in the request URL/headers and also what is coming back in the response, but I can't seem to find a way in the volley code to print this to the log.

我收到的错误是

com.android.volley.NoConnectionError: java.io.IOException: No authentication challenges found

我读过左右,这可能是由于401的反应,但我真的不知道这意味着什么,或者至少如何证明/测试。我真的很困惑,它适用于一个帐户,而不是其他。

I've read around that this might be due to a 401 response, but I don't really know what that means or at least how to prove/test that. I am really confused that it works for one account and not another.

网址略有不同,一个是我们的英国网站和其他我们上午,但除此之外,没有什么区别。

The url is slightly different as one is for our UK site and the other our AM, but other than that there is no difference.

感谢

推荐答案

事实上,我已经解决了这个问题,包括 WWW验证在服务器响应头。

Indeed, I have solved this problem by including the WWW-Authenticate header in the server response.

不过,如果你添加的头 WWW身份验证:基本境界=和你的API也会因此被Web客户端,某些Web浏览器将触发弹出要求基本凭证。

However, if you add the header WWW-Authenticate: Basic realm="" and your API is also consumed by web clients, some web browsers will trigger a pop up asking for basic credentials.

有关我正确的解决方案使用自定义方案是。正如本博客文章解释说,我用 xBasic 而不是基本在头响应。

For me the right solution has been using a custom scheme. As explained in this blog post, I use xBasic instead of Basic in the header response.

WWW验证:xBasic境界=

通过这个头,不仅排球正确解析响应,但我也避免Web浏览器显示的验证弹出。

With this header, not only Volley parses the response correctly, but I also avoid web browsers showing the authentication pop up.

这篇关于发现凌空错误没有认证的挑战 - 机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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