Using WebView setHttpAuthUsernamePassword?

前端 未结 8 494
死守一世寂寞
死守一世寂寞 2020-11-30 05:45

I\'m trying to do basic authentication to view a protected url. I want to access the protected url which looks like this:

http://api.test.com/userinfo/vid?=1         


        
相关标签:
8条回答
  • 2020-11-30 06:25

    If you do not mind writing your username and password into the url, then it is not necessary to change your webview client.

    Just open the following url in the webview:

    http://username:password@api.test.com/userinfo/vid?=1234
    
    0 讨论(0)
  • The default behavior of a WebView is to discard all authentication requests. Even if setHttpAuthUsernamePassword.

    You have to set a WebViewClient and Override the method onReceivedHttpAuthRequest

    0 讨论(0)
提交回复
热议问题