相关疑难解决方法(0)

使用WebView setHttpAuthUsernamePassword?

我正在尝试进行基本身份验证以查看受保护的URL.我想访问受保护的URL,如下所示:

http://api.test.com/userinfo/vid?=1234
Run Code Online (Sandbox Code Playgroud)

所以我使用WebView执行以下操作:

mWebView.setHttpAuthUsernamePassword("api.test.com", "", "me@test.com", "mypassword");
mWebView.loadUrl("http://api.test.com/userinfo/user?uid=53461");
Run Code Online (Sandbox Code Playgroud)

但验证似乎不起作用,我只是得到一个输出错误页面.我在这里正确使用WebView方法吗?

更新:尝试卷曲:

curl -u me@test.com:mypassword http://api.test.com/userinfo/user?uid=53461
Run Code Online (Sandbox Code Playgroud)

它拉页面很好.我尝试了主机参数的每一个组合,api的所有者不知道我的意思是什么'领域'虽然(我也不知道) - 我可以给他们什么信息来帮助这个?

谢谢

android

20
推荐指数
4
解决办法
3万
查看次数

标签 统计

android ×1