title: How should I approach integration testing for APIs involving Facebook?
body: <p><strong>The scenario</strong></p>
  
  <p>Suppose there is a mobile app connected to a backend API (nodejs, though not that important), and you can "register with Facebook". </p>
  
  <p>Registering with Facebook implies a couple of steps: on the mobile part the user authorises FB access, FB provides the app with a token, that token is sent to the server and (let's suppose using a passport-facebook strategy) that token can be sent again to FB along with app credentials so that FB can transform that token into a User object.</p>
  
  <p>Suppose on the backend side you use that User object to create your own App User entry, fetch the profile picture and store it, etc. And by manually testing you can see that the User object has a specific structure: an <code>id</code> field, an <code>emails</code> field (which is an array with a complex structure), etc. You end up writing you registration steps based on that.</p>
  
  <p><strong>The problem</strong></p>
  
  <p>While I know that the FB returned User object looked in a certain way at a certain point in time I cannot be sure it will be the same in the future and I won't get an "cannot access something of undefined" error message when they decide to change the structure of that. On the other hand I would really like to have integration tests that include third party integrations, like FB.</p>
  
  <p>I know that you can have (virtual) FB test users and I checked out their documentation for testing, it only shows example of Mobile app testing as far as I know, no backend oriented testing.</p>
  
  <p>I would ideally need to be able to either fetch a (test or not) FB User with which I can test out my registration process or even better a token that can be used in the whole API flow, so that the whole process is covered. Any ideas where I should look or if it is worth investing in this direction?</p>