Question

My situation is this: in my site I have username and password (of my Facebook account) stored in 2 php variables: $user and $password. Now I want to log in my Facebook account with those access data. Then, how can I send user and password to Facebook API without "passing" through the standard Facebook login form? Thanks :)

Was it helpful?

Solution

Short answer: you cannot do that.

You can't pass username and password to Facebook for authentication. Username and password can only be entered into the Facebook authentication form, either through a redirect or iframe pop-up.

Requesting and storing Facebook user passwords is a violation of Facebook platform policy.

You can get an access token after going through the authentication dialog, and that access token can be used to take actions on behalf of the user or access their Facebook information without further authentication for as long as the access token is valid. Access tokens expire, but you can extend them up to 60 days. They also get rendered invalid through a number of other user actions such as changing the user password or manually evoking application permissions.

Facebook OAuth 2.0 documentation is here: https://developers.facebook.com/docs/authentication/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top