Possible to access Cookies in a WebView in React Native? - react-native

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.

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

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

Related

Share Url from browser to React Native app

I want to share URLs from the browser to my React Native app and open them in the app, how can I do that?
This is called deep-linking, that your app launches and even does some actions depending on the called URL of your app. Many apps use it that's how you probably know it.
You can read about this and implement it.
Here is some articles and documentation about it:
https://reactnavigation.org/docs/deep-linking/
https://medium.com/react-native-training/deep-linking-your-react-native-app-d87c39a1ad5e

Is it possible to integrate a TWA into a React Native project?

I am wondering if it is possible to integrate TWA (Trusted Web Activities) into an existing React Native project. This way I could have a section in my app where costumers can use my PWA inside my app. As fallback for iOS I would use something like their WebView. If it is possible, how would I go about implementing it?
In short, yes, it is possible to integrate Trusted Web Activity into a React Native App.
You'd need to create an Android Native Module that wraps Android Browser Helper into a React Native API. Since you want to use the Trusted Web Activity as part of your app, you will probably be looking into wrapping TwaLauncher.
Then, you will need to implement a module for iOS, which will have the same API in React, but will use the WebView as an implementation.
It seems someone has already created a wrapper for Android (but I haven't tested).

How to integrate unity3d AR app inside React native app

As I mentioned, I need to insert a unity project into an app in react native.
I saw that there is this component that should help me do this (react native unity view).
I saw that there is a way to intercept messages sent by unity. (onUnityMessage method), but how do I send some data from react native app to unity? (example: auth token).
I must be able to send the token to unity so that it can be used by unity app.
How can I do this?
thank you in advance!

Automate login, navigation and parse of web pages in React Native

I would like to get information from a specific website (https) from within a react native app.
For that, I need to:
Open and Login to the web page (https)
Make a simple navigation (known tag in html)
Parse the resulting page for data.
Present the data in a React native component (not webUI).
Any idea what would be the best way to do it?
10x,
EyalS
Here is what I would do:
Use the following tutorial to use Browserify to wrap Zombie.js within a react-native app.
Navigate with Zombie.js to the data that you are seeking.
Display the data.
Happy coding.

react native app auth - How to make scopes as optional?

I am trying to implement OAuth into my react native app.
I am using react native app auth.
I would like to make scope as optional.
Currently, it is mandatory.
How do I do that?
Can I modify the code of react native app auth and build it and import into my Example code?
React Native app auth - Github Link
One of the maintainers of react-native-app-auth here.
Up until this moment I was under the impression that the scope parameter was a required paramater in the OAuth 2.0 request spec, but looking at the relevant spec definition, it appears to be optional.
You should be able to remove the array.length check in the validateScopes helper. You can try this by editing the index.js file in your app's node_modules/react-native-app-auth/ directory.
Once done, you can pass an empty array [] as scopes.
I'm not sure how the underlying AppAuth native libraries deal with it, but if it works, you can open a PR to react-native-app-auth and I'm happy to accept the change.