Opening new default browser window in plain React on a Mobile while using Facebook browser - reactjs

Folks,
We are in a unique situation here. Our React site integrates with Signicat for identity solution. Most of our user base comes from Facebook i.e. they use the Facebook app, look at our posts and click on links we post which redirect to certain sections in our website which require identification.
So an example link posted on Facebook group https://example.com/en/startpage-in-english/ is converted into https://l.facebook.com/l.php?u=https%3A%2F%2Fexample.com%2Fen%2Fstartpage-in-english%2F%3Ffbclid%3DIwAR3loYqYOvom5k8_mOww89p5tun5H9HqIIKE1ebwwCcB3PD4jzxpTVyZGCk&h=AT1E3p1ejYWH9l2KhUo8D_RVjl_EzKBat4woeMHgRv7yXpT9Y-EZoBcK26sQtjjBBwAQt7Pt83a-i_k5JCGuvOBWfgB9pZ7Uv8LnDlyphNKc1Og0nl6QIqWd_nFEAva3OWN-PZ3byqsU7K0I5A&__tn__=-UK-R&c[0]=AT0-5n51iPMlSYghORXW8qxYXJQEejQTAhfiDQ3P3DK_ZTZM3GWbN4zXYKf-nyD_hWJdxQccenDp-5VgphfWuD6ZQ0ikeXq4lv4bjLbSJVFP9k4IxeMBT5mDa9jNdYnYlNs-DkXOM-LiPhhl-Obra9CAbtvihe-G7-8. When users click on the link, Facebook by default opens the link in its own Facebook browser. The subsequent steps in our portal need the user to identify himself and when the identification is completed and in the final step the request to Signicat hangs forever.
We identified that this issue is only happening with Facebook browser and hence one of the workarounds was to Open the default browser with the link to our website.
Note that:
a. this is not a React-Native app, our website is built using plain React hence the WebView solution does not work.
b. Facebook browser suppresses "window.open" with "newwindow" call and simply displays the site in the same Facebook browser instance.
So bottom line is, we need a way to Open the default OS Browser from Facebook App/Browser with the link to our site. Hope somebody can help!
Thanks in advance...
SG

Related

I am loging in to facebook page while I am using react-facebook-login in react

after integrating facebook login button in react app when I am clicking on it. A login form is opening in new tab after logging in the same page is redirected to facebook welcome page. Why this facebook welcome page is opening? I am using latest react version 18 although the given library supports 16 or below. Please suggest any solution to this. Similarly I am facing the problem with react-google-login library where I am getting getting popup closed as error. Although I have tried clearing cache and cookies but got no result.
for login with google, old sign in with google library is being deprecated https://developers.googleblog.com/2021/08/gsi-jsweb-deprecation.html in favor of the new Google Service Identity SDK,
You can use #react-oauth/google it uses the new SDK

React native: what is the difference between opening an external URL in-app and launching the native browser

I am using React native to develop a mobile application, and an external module's function I use to provide the user login flow via an identity provider, opens the link to the sign-in flow in-app, like shown in the header below.
The sign out functionality offered by this module is documented to be obsolete, so I am implementing my own routing to the identity provider using Linking from the react-native node module, except this actually opens my native web browser rather than showing the page in-app (and subsequently fails to redirect back to my app).
My question is, what is the technical difference between an app opening a link in-app like shown above, and the app simply launching the native browser, such as chrome? And would this affect functionality like redirecting back to the initial application once the user process has been fulfilled (my guess is that it should not affect it).
I believe that the difference is that the in-app browser on IOS is an instance of
sfsafariviewcontroller and on Android, is an instance of Chrome Custom Tabs.

After i create a APK to PWA i see toolbar of browser

I have a problem with my first PWA.
I have created one with reactjs and configured good manifest.
I follow step by step google guide.
PWA, works perfectly, and i see "add to home button".
After QA i wanted to publish it in store.
I used https://appmaker.xyz/pwa-to-apk.
Now i have app publish in the store but when i open it, i see a browser toolbar and i can't use it as a native app.
Someone can help me?
How about using TWA (Trusted Web Activity)?
Using Trusted Web Activities
This can be achieved by proving that the app and the web trust each other.
If you can prove it, you can prevent the browser toolbar from being displayed.
I'm sorry if you don't get the answer you want.

Share angular app web pages on telegram

I want to share a link of my angular web app on telegram with a friends, and I want telegram application to show a preview of my page as stated here. I did exactly what the link says but it seems the sharp sign in the URL to my site my website cause's this problem. Any idea how to solve it?
I also activated $$locationProvider.html5Mode(true) to remove sharp sign from the urls, but it just removes sharp sing after page is loaded and the address to a specific page has still sharp sign
Here is what I mean by sharing on telegram:

How can I implement the facebook authentication in a MEAN application preventing CORS problems?

I'm implementing an application using the full MEAN stack.
I created a login page to signup with facebook to be able to show a profile page. But I discovered some problems. For this reason, I created a smaller version of my webapp, maintaining the same project structure.
The complete code, executable (only replacing "client id" and "secret") with "npm install" and after "nodemon" is available here: https://github.com/Ks89/MEAN-OAuth_Example
If I'll call (with a browser) the rest API that I created to login with facebook at "http://localhost:3000/api/auth/facebook", everything will be ok!
But if I'll want to do the same thing, clicking on the "Login" button, I'll receive the error as in figure:
I know that the problem is related to CORS, but how can I'll fix this in my application, maintaining the same project structure?
I don't want to put the "rest path" inside the HTML. I tried for many days different solutions without success.
If you want, experiment directly on my application that I created exactly to write this question ;).
If really necessary, I'll able to post the entire source code here, but I prefer an organized and executable code into a repository for this particular question.
Please, give me some ideas and hopefully a solution, because I'm really blocked.
The example routes from the passport-facebook repo are intended for multipage apps, not ajax requests. If you look at what those routes are doing, /auth/facebook is just a redirect to Facebook where the user is expected to log in if necessary and authorize your application. When you make that same request from angular, it follows the redirect and tries to load the Facebook page, but the browser blocks you as your console screenshot shows. CORS would be relevant if Facebook wanted to allow you to request their login form across origins, but they don't because that would basically make you a phisher.
It looks like you're trying to handle authentication without leaving the page, but at some point you're going to need the user to leave your site and be redirected to Facebook in order to complete the OAuth flow. You can either open a pop-up containing the Facebook OAuth dialog (it looks like this is what the Facebook JavaScript SDK does by default) or just use your app's current tab with something as simple as <a ng-href="{{facebookOauthUrl}}">Log in with Facebook</a>.

Resources