作者lovelycateye (我还想要更多力量)
看板AndroidDev
标题Re: [问题] Url Authentication 名称与密码(1000P)
时间Mon Feb 20 17:26:44 2017
※ 引述《ja11s4o1n7 (小奕)》之铭言:
: 想请教一下,
: 今天app要从一个url网址登入,并取得xml回应,
: 由於网页需登入,从browser登入方式是贴上
: http://admin:[email protected]
: 这样就能直接登入,
: 可是app用okhttp夹带这样的url,
: 会一直收到unAuthentic,
: 试过许多夹带名称和密码的方式都没用,
: 不知道该怎麽办了>_<
: 希望知道的大大能帮忙,谢谢!
: 为了谢谢帮忙解决成功的版友,
: 会奉上1000P以示感谢。
建议了解一下 http basic authentication.
https://en.wikipedia.org/wiki/Basic_access_authentication
okhttp 作法
https://github.com/square/okhttp/wiki/Recipes#handling-authentication
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 60.251.144.84
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/AndroidDev/M.1487582809.A.167.html
※ 编辑: lovelycateye (60.251.144.84), 02/20/2017 17:29:36