2

If you create a WebView within a react-native application, is it possible to access the cookie from the WebView to be passed in subsequent requests?

An example would be presenting the User with a login page with reCaptcha in a WebView. Then using the authentication cookies from a successful login to make subsequent API requests to the same site.

Zach
  • 315
  • 6
  • 15

2 Answers2

1

React Native is just a bridge on top of the native code. Anything you can write in objective-c/java can be used in React Native by creating native modules.

I am not sure if there is JavaScript code present for clearing the cache of a webview, but you can certainly write native code for it and then bridge it using native module.

Here is the link for the native code(iOS) : https://stackoverflow.com/a/5606703/2164029

Tutorial for creating native moduels : https://facebook.github.io/react-native/docs/native-modules-ios.html

atitpatel
  • 3,104
  • 1
  • 24
  • 34
1

I believe this https://github.com/joeferraro/react-native-cookies should provide you what you want.I have used this to clear cookies successfully.

hyb175
  • 1,291
  • 8
  • 13