title: REST API for website which uses Facebook for authentication
body: <p>We have a website where the <em>only</em> way to login and authenticate yourself with the site is with Facebook (this was not my choice). The first time you login with Facebook, an account gets automatically created for you.</p>
  <p>We now want to create an iPhone application for our site and also a public API for others to use our service.</p>
  <p>This question is about how to authenticate with our website from the app/API and is broken into 2 parts:</p>
  <ol>
  <li>What is the correct way to handle REST authentication from an API to a website which only uses Facebook OAuth as an authentication method?</li>
  </ol>
  <p>I have read and researched a lot about standard methods of authentication for REST API. We can't use such methods as <a href="https://stackoverflow.com/questions/7919533/rest-api-authentication-tokens">Basic Auth over HTTPS</a>, as there are no credentials for a user as such. Something like <a href="http://acaasia.blogspot.com/2013/04/designing-secure-rest-web-api-without.html" rel="nofollow noreferrer">this</a> seems to be only for authenticating applications using the API.</p>
  <p>Currently, the best way I can think is you hit an /authorize end-point on our API, it redirects to Facebook OAuth, then redirects back to the site and provides a 'token' which the user of the API can use to authenticate subsequent requests.</p>
  <ol start="2">
  <li>For an official application that we create, we wouldn't necessarily need to use the public API in the same way. What would be the best way then to talk to our website and authenticate users?</li>
  </ol>
  <p>I understand (I think) how to authenticate 3rd-party applications that are using our API, using API (public) keys and secret (private) keys. However, when it comes to authenticating the user who is using the app, I am getting rather confused about how to go about it when the only way we have to authenticate a user is Facebook.</p>
  <p>I feel like I'm missing something very obvious, or don't fully understand how public REST APIs should work, so any advice and help would be greatly appreciated.</p>