i have a facebook login on my website and when you click it it launches a pop up where the user signs into Facebook and if they haven’t authorised my site it does that. I know you can request data using Facebook scope function but how do I take this data and store it in a database so I can save their email address etc. I have a register function using Facebook which saves the data into my database but I was wondering if I could streamline login and authorisation this way? if so how would I do it? thanks in advance
Share
You can work with sessions.
First download Facebook PHP SDK here: https://github.com/facebook/php-sdk
Put facebook.php and base_facebook.php in the folder “facebook”
Put dbconfig.php in folder “config”. Source:
functions.php in the folder “config”. Source:
fbconfig.php in folder “config”. Source:
logout.php source:
Example usage login.php. Source:
Example usage home.php. Source:
Edit fbconfig.php and dbconfig.php with your own details. This is a copy/paste from my own files, but they will give you an idea how you can authenticate and login users through facebook and create users with the info facebook provides.
Good luck!