Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Home screen app (android) facebook login opens browser

I'm working on a website that is focused on mobile users and uses a manifest to be opened standalone when added to the home screen. This works well, except for the Facebook login function. Whenever I try to login it opens the Facebook link in the browser outside the app. I then have to manually return to the app and reload the page to be logged on.

How can I stay inside the standalone app when logging in?

I tried using window.location as explained in this popular answer but no change. I also tried using window.open as explained here but again, no luck.

You can try it on this test page that has an adjusted manifest and login option to stay inside the test page. I used a Samsung Galaxy S5 for testing.

like image 714
Hugo Delsing Avatar asked Dec 29 '17 08:12

Hugo Delsing


People also ask

How do I turn off Facebook mobile browser?

Hit your profile picture in the top left corner, then tap Settings and privacy > Display and sound. In the “Web browser” section, you will see the option “Use in-app browser.” Please disable it. That's it.

What is an embedded browser Android?

Embedded browsers are software components available to mobile apps to invoke the browser, and are the only ways both platforms allow users to interact with a browser. It's important to emphasize – we used each platform's embedded browser, not our own browser.


1 Answers

You should not stay inside your app while logging.

Redirecting the user to the Identity provider (Facebook) in your case it is the normal life-cycle of an Oauth2 login or Single Sign On login. On the OAuth2 server you can set the redirect url which is the address you want the user to be send after login.

https://developers.facebook.com/docs/facebook-login/web#redirecturl

Login to your facebook app account: https://developers.facebook.com/apps and change the redirect url from your app control panel.

like image 119
albert Avatar answered Nov 07 '22 10:11

albert