Take the 2-minute tour ×

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 :)

share|improve this question

1 Answer 1

up vote 2 down vote accepted

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/

share|improve this answer
Excellent answer. Couldn't have said it better myself ;) –  DMCS Mar 6 '12 at 20:33
From a deeper link, there seems to be some prototype work on automated access, but currently in "closed alpha": developers.facebook.com/docs/authentication/devices –  akavel Jun 1 '12 at 14:13

Your Answer


