React-native, Get response from "WebView" - react-native

I am new in react native,
I have integrated "WebView" for user login in my app so, hear i have need only login response like user is authenticate or not without post any parameters or message, authentication is handle by that particular site so its not in my hand and i can't change any thing so it is possible for app login.
If yes then how can i get response in "onMessage" in my webview?
App Flow:
- Splash screen
- Login screen (Webview)
- If user authenticate then redirect on dashboard
I have used "react-native-webview"
npm
Thanks in advance

Related

How to share user session in React Native App and WebView component

I have an application that shares backend with a web. This application has basic email/password login that returns Access Token which is being sent as a header for any other requests. The application also has a screen that is a WebView which displays the web version of this app.
My problem is that I don't know how to share user session between RN app and the WebView. When the user logs in the application it should also log him in the WebView page and if the user logs out it should log him out the WebView aswell.
Is there any way, to inform the WebView that user has logged in and that he should be logged in in the WebView as well?
I tried sending the Authorization header in the WebView source but it doesn't work. https://github.com/react-native-webview/react-native-webview/blob/master/docs/Guide.md#working-with-custom-headers-sessions-and-cookies
Any auth is based on a secret. First, you need to decide what is your secret, it can be a session identifier or jwt token. Then you can communicate between React Native -> Web and back Web -> React Native
follow this guide communicating-between-js-and-native and share your knowledge about this secret and use it for your requests.
Related to custom headers this will set the header on the first load, but not on subsequent page navigations.

Discord auth with react native frontend and express server backend

In my react app i added a button that redirects to the login page url. In my backend login page i used passport.js to make discord oauth and then redirect to an callback page where i have a simple rendered page who said is logged in successfuly, now he can return to the app. After that, in my frontend i added a button where it sends a axios post request with credentials and it says its unauthorized, so in few steps i need to use the same cookie from the web page i logged and need to access that from my react app.
BTW. i already use cors in my backend and i watched some tutorials but cant find a solution for that. Thanks in advice

React Native - Nodejs Express Social Login

I have been pulling my hair to understand what is the method to implement facebook/google login for a react native mobile application which has a nodejs back end.
I currently have social login properly working for reactjs website, which is using passport.js.
In the website, clicking facebook/google login buttons calls my server API. From server API request is redirected to Facebook which provides a form for the client to login. Once the user is authenticated, Facebook shares the requested user info to node js server and the server returns the JWT to the mobile application.
How can I port this method to react-native mobile application?
Any help is highly appreciated!!

Xamarin Forms WebView, register to FCM notifications if authenticated to the site in the webView

I got an app that only contains a webview, pointing to a site with a login screen. The users of the app should be able to get notifications, but only if they are authenticated (logged in to the site in the webview). Is there any way to tell if the user of the app is authenticated to the website in the webView? Any way for the app to know if the user clicks the login button in the webview?
I know that we can override OnReceivedHttpAuthRequest in a custom renderer, but this is not triggered by the login screen of this website so it doesn't work in this case.
Any suggestions?

How to login twitter app rather than Safari web in react native?

I use react-native-simple-auth in my project but i can login twitter in web.I want to login with twitter app instead of safari view in react native. How to do this? Any Idea?
If you have installed Twitter in the phone use this:
Linking.openURL('twitter://app')
This is the snippet that open an external app. It open but you can't pass params to log in. Only open the app and, if you are logged, you will automatically enter to the app logged, else, just will open Login view.