Delete cookies from WebView

I'm using WebViews for login in to social networks like Facebook, Twitter, Windows live etc. (all based on OAuth) for posting information directly from the game. The workflow is managed server-side and also the OAuth tokens are persisted there. I provide a logout button which invalidates the OAuth tokens server side.

As it appears the WebView is actually persisting cookies permanently (so even after the application has been closed). The problem is now that on some sites the user can choose the server to remember the login based on cookies. So if the user login again it will be automatically the same user as last time and cannot change the user anymore. The only way is to de-install the app or wait until the cookie expires (which can take a long time).

Therefore can you please add a function to remove the cookies from the WebView?

On iOS it can be achieved with the following Objective-C code:

1
2
3
4
5
6
NSHTTPCookie *cookie;
NSHTTPCookieStorage *cookieJar = [NSHTTPCookieStorage sharedHTTPCookieStorage];
        
for (cookie in [cookieJar cookies]) {
    [cookieJar deleteCookie:cookie];
}
views:2258 update:2011/9/17 18:17:57
corona forums © 2003-2011