※ 引述《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://www.ptt.cc/bbs/AndroidDev/M.1487582809.A.167.html
※ 編輯: lovelycateye (60.251.144.84), 02/20/2017 17:29:36