Make Android WebView not store cookies or passwords

前端 未结 6 1021
死守一世寂寞
死守一世寂寞 2020-11-30 22:13

I use an Android WebView for Twitter OAuth: Twitter asks the user to log in and authorize the application, I retrieve the access token and persist it in my application.

6条回答
  •  粉色の甜心
    2020-11-30 22:43

    Don't clear cookies beacause it will effect other sessions like facebook etc.. stored inside the cookie so try to follow this method

    Before oauth transaction such as before the webview creation

    CookieManager cookieManager = CookieManager.getInstance();
    cookieManager.setAcceptCookie(false);
    

    After oauth transaction let accept cookie by setting

    cookieManager.setAcceptCookie(true);
    

    it will work i have tested it..

提交回复
热议问题