facebookarchive / php-graph-sdk

The Facebook SDK for PHP provides a native interface to the Graph API and Facebook Login. https://developers.facebook.com/docs/php
Other
3.17k stars 1.96k forks source link

can getRedirectLoginHelper open mobile app if user have mobile phone? #1135

Open jintor opened 5 years ago

jintor commented 5 years ago

This question is usually not understood by developers when I ask about this... I often get "I don't understand the question"... web-fb-web3

I will try my best by explaining the context first.

In website there is a possibility to add "login with facebook" button. The normal flow is

1- user arrives to example.com with a "login with facebook" button.

2- when user click that button, there is a facebook popup

2a- if user already logged in with facebook -> the poup ask "app permission" -> goes back to example.com logged in

2b- if user is not logged in facebook -> the popup ask to login, etc --- this flow is ok for desktop because users normally uses chrome or safari to use facebook

** The problem in mobile phone,** is that users don't use chrome or safari, they install facebook app

--- This flow in mobile phone "breaks" the one click aspect of it and users get discouraged because they usually DONT remember their facebook password :(

••••• with this https://developers.facebook.com/docs/php/howto/example_facebook_login/ -->> it dont recognize if user in mobile or desktop by default

QUESTION : with getRedirectLoginHelper : is there a way or code to add to make open facebook app when user is in chrome/safari mobile ????

to achieve this flow enter image description here

I tried with javascript but it don't open facebook app

and console log says You are overriding current access token, that means some other app is expecting different access token and you will probably break things. Please consider passing access_token directly to API parameters instead of overriding the global settings. with php, it's also the same "stay in chrome" include('facebook/vendor/autoload.php'); $fb = new Facebook\Facebook([ 'app_id' => .... $helper = $fb->getRedirectLoginHelper(); so is it possible to open facebook app when user have mobile phone ? if yes how ?