Wizcorp / cordova-plugin-wizviewmanager

PhoneGap plugin for creating/showing/hiding/messaging/animating additional views outside of the main window.
MIT License
57 stars 37 forks source link

Deleting or clearing cookies #75

Closed stephenlacy closed 9 years ago

stephenlacy commented 9 years ago

I am using wizViewManager to create an authentication view with Facebook. Currently it works until the user needs to logout of the app (including Facebook). Is there a particular method for clearing the cookies stored in the view?

aogilvie commented 9 years ago

@stevelacy This should do the trick... http://stackoverflow.com/a/179514

BTW, Are you aware of https://github.com/Wizcorp/phonegap-facebook-plugin ?

stephenlacy commented 9 years ago

Yes, our situation has the authentication going through our server (thus the wizView). I tried that delete function, I'll check if the issue is elsewhere. Thanks

stephenlacy commented 9 years ago

Update, I have attempted several times to delete the cookies in the wizview. The cookie context of wizview is not the same as the phonegap document.cookie, and as such I am not able to delete the cookies in the wizview.

aogilvie commented 9 years ago

@stevelacy Have you been able to execute the code in the wizview?

For testing you can attach a device via USB and open Safari > develop > select device > select wizView and run the delete code in the web inspector.

If that works then you need a way to execute the code from your main PhoneGap view. This can be done by loading javascript into the view with wizViewManager.load() API. The JavaScript you should inject should have a message event listener window.addEventListener('message', wizMessageReceiver);. Now you can send a postMessage from PhoneGap view to wizView to call a function to delete the cookies.