api - Facebook Connect - Authentication and Security -


I would like to develop an external website using Facebook Connect instead of one's own login and registration process.

First: Please do not respond to "View Document on Facebook Documentation". I have read all the pages, I think that many times. But I could not find any answer.

I use this code for my login button:

  & lt; Fb: login-button v = "2" size = "large" autologoutlink = "false" onlogin = "window.location = '/ index.php'" & gt; Connect with Facebook & lt; / Fb: login-button & gt;  

I use to show the name of the current user:

  & lt; Fb: name uid = "loggedinuser" link = "true" firstnameonly = "false" rights = "wrong" useyou = "false" ifcantsee = "facebook-user" & gt; & Lt; / Fb: name & gt;  

And in the end, for logout, I use the following link:

  & lt; A href = "#" onclick = "javascript: fb.connect .logout and redirect ('/ index.php'); return returned" & gt; Logout & lt; / A & gt;  

It is quite easy to explain this documentation well.

But my problems start when I want to know whether a user is logged in or not. Facebook tells everything on this topic

But I do not understand what I have to do

  • If a user requests a page "members.php" and is not logged in , Then there should be a message or it should be redirected but Facebook's Javascript function is not safe, right? Generally, I use server side authentication.
  • I would like to know that there is no user login or not to show log in button or logout link.
  • If a user is logged in, I want to know my user ID on Facebook.

Thank you for your help!

You are right that JavaScript is not secure

If you are using the Official PHP Library If you use, you need to add the following lines of code at the beginning of your members. Php,

$ facebook = new Facebook (API_KEY, API_SECRET); $ Fb_user = $ facebook- & gt; Need_login ();

If this is not a login, the user will be redirected to access Facebook.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -