Search code examples
facebookfacebook-graph-apifacebook-php-sdk

Can I check if user is registered in facebook before appearing the login button?


For my case, I consider 4 different scenarios when a user needs to log in to my website via a third party website like facebook. But I stumbled upon a fifth possible case that I am not sure what will happen if a user is not registered at all in facebook..

My Website has it's own registering system for this case. But if the user clicks on facebook register button, after he registers to facebook, will he be returned to my website? Or his experience will be transferred over facebook?

Is there a Way to check if a user visiting my website is registered in facebook before appearing the fb login button?

Scenario 1

  • User is logged in my website
  • User is logged in into facebook
  • User is considered logged in

Scenario 2

  • User is logged in my website
  • User is Not logged into facebook
  • User is considered logged in

Scenario 3

  • User is Not logged into my website
  • User is logged into facebook
  • User is registered into my website
  • User is considered logged in

Scenario 4

  • User is Not logged into my website
  • User is Not logged into facebook
  • User is Not registered into my website
  • User logs into facebook by clicking on fb login button
  • User registers to my website app and gets redirected to my website
  • My website registers the user using data returned from facebook
  • User is considered logged in

Scenario 5

  • User is Not logged into my website
  • User is Not logged into facebook
  • User is not registered into facebook
  • .. What happens next?

Solution

  • There is no way to check if the user is registered on Facebook.

    In your 5th scenario, when the user clicks the fb login button, and chooses to register to Facebook, after s/he enters the membership information and clicks 'Register', Facebook sends her an activation link, which the user has to click to activate her membership.

    Because of the activation step, the user cannot go back to the Facebook Login process that started in your site. S/he will have to go back to your site, and click on your Facebook Login button again.

    I just tested this with a dummy email and this is the final screen in the registration process after I clicked a Facebook Login button on some website:

    enter image description here

    There's nowhere to go after this screen. The user has to close it and restart the Facebook Login process from your website.