title: Facebook login using OAuth 2.0
body: <ol>
  <li>I want people to log in to my site with their Facebook accounts. </li>
  <li>I need to pull some info from their Facebook profile and add it to my site's database</li>
  </ol>
  
  <p>I have tried using the OAuth 2.0 method which makes a redirect to this url </p>
  
  <pre><code>https://www.facebook.com/dialog/oauth?
      client_id=YOUR_APP_ID
     &amp;redirect_uri=YOUR_REDIRECT_URI
     &amp;scope=COMMA_SEPARATED_LIST_OF_PERMISSION_NAMES
     &amp;state=SOME_ARBITRARY_BUT_UNIQUE_STRING
  </code></pre>
  
  <p>I successfully authenticated the user but now the main problem arose. How do I access the data which is sent as response all I can see is a <code>GET</code> variable named <code>code</code> and some long text. How do I convert to usable data?</p>
  
  <p>I use php for my website</p>