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.
I have no need (and do not) store the user password, but the WebView keeps Twitter's cookies around, and it also asks the user if he wants it to remember the password. As a result of this, even after the de-authorizes the application via his Twitter account page, and my application destroys the access tokens, the next time the WebView is opened, it is probably still logged in, and even if not, it has the password box already filled.
How can I force WebView to not ask to remember passwords, and to not persist session cookies? If that is not possible, can I delete all its stored state (except maybe the image cache)?
You can use this to prevent cookies from being stored and clean cookies already stored:
In one line, Try this. I think this should be called after starting the webview.
I have used following solution:
Following method does not worked for me:
A possible reason may be that we have not synced the cookies as following:
But it may be taking time.
Forcing
WebView
to not ask to remember passwords will also not work.And it is also not good for usability.
For not saving passwords:
For cookies:
I am not very sure for the cookies implementation.
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
After oauth transaction let accept cookie by setting
it will work i have tested it..
This is the best answer I have seen in this context