/    Sign up×
Community /Pin to ProfileBookmark

PHP User authentication with facebook integration help please

Hi,

Thanks for taking a moment to read my post.

I have searched this forum and have read every article I can get my hands on and every help document on the facebook developer site and I am still a little cnfused, its like I have all the pieces of the puzzle but not 100% sure what the picture is supposed to look like or how they fit together.

Let me start by explaining what I want to do and what I am working with

I have a php based user authentication script, that I rebuilt myself from another script, made some changes, added features etc etc

This script registers a user storing their first and last name, email, username, password, group they belong to and a couple of other bits of info

When logging in their username and password are passed to an authentication script which checks the database for a match and if found creates cookies to keep them logged in then redirects them to either a admin or members area depending on their user group and level

What I would like to do now is to modify this script to incorporate the facebook login method

First i found some facebook code that displayed a button and clicking caused a login popup, authentication and access request stuff for the info I wanted to access and so on, then when they approved all that it closed and the button on the page if reloaded would now show they were logged in and who else they knew was logged in etc

This code and the facebook developer page where I found it did not explain how to take this javascript and div tag they provided and take the users info and allow your own database to use it and keep a user logged in to my site

I also found on another facebook developer page and some other site article a similar one which involved a bit of text with an on click event again using javascript but this time a bit more complex including a redirect url to a fbconnect.php page full of code that found the info of the currently logged in facebook user and allowed you to access it from a variable it created

But again did not explain how to integrate that into a websites current user authentication system to allow login and keep users logged in

I have lots of knowledge and code but cant see the woods for the trees so to speak lol

What I need is users to be able to either signup on my site like any other site, or signup using their facebook login, then their info stored in my database for future use

Logged in users have access to a members area in which they can submit content in the form of various different stuff that gets stored in the database and associated with their account, so I need users logged in via facebook to also have this ability and for the stuff associated with their account to be accessible to them when ever they login to my site via facebook etc

I am also unsure how I modify my script to recognize a logged in user who logged in via facebook as lets say someone logs in via facebook for the first time, they have no account on my site, facebook gives me their name email dob etc etc but no password, so all the info can be saved into my database except password would be empty, now my script verifies username and password is in database each time user loads a protected page while logged in, but what would i need to check them against if they logged in via facebook? since facebook doesnt have any password info for me to store in my database user table, or would I have to reconfigure my entire user area script to check against something else if logged in via facebook

I looked for a pre built user area script with admin and member areas that had facebook already integrated but couldnt find anything for free, I found one for $12 but it didnt really mention too much and I didnt feel like paying just to see if it would work out and then find out it was a waste of money and time

Any and all advice, suggestions, code samples, links, scripts etc greatly appreciated

Thanks in advance

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @BWWebDesigns spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...