title: FOSOAuthServerBundle - generate manually an access token
body: <p>I have a <strong>symfony2 website</strong> and a web service secured via <strong>oauth using FOSOAuthServerBundle</strong> accessible via an iOS app. On the website I use <strong>FOSUserBundle</strong> and <strong>FOSFacebookBundle</strong>.</p>
  
  <p>The only thing I miss is giving the possibility to the user to login with facebook on the iOS app and to return him an access_token for my oauth linked to his user account so that he can access my api like other users. </p>
  
  <p>So basically I want to <strong>send the user facebookID and facebook_access_token</strong> to my webservice, check that the user is correct (token matches my app) and <strong>return an authentication token</strong>.</p>
  
  <p><strong>QUESTION:</strong> is there an easy way to add a "Facebook" grant_type to FOSOAuthServerBundle ?</p>
  
  <p>I know some people have done this seeing these questions:</p>
  
  <ul>
  <li><p><a href="https://stackoverflow.com/questions/4623974/design-for-facebook-authentication-in-an-ios-app-that-also-accesses-a-secured-we">Design for Facebook authentication in an iOS app that also accesses a secured web service</a></p></li>
  <li><p><a href="https://stackoverflow.com/questions/8141037/get-application-id-from-user-access-token-or-verify-the-source-application-for">Get application id from user access token (or verify the source application for a token)</a></p></li>
  </ul>
  
  <p>But they do not explain how, they do not seem to use FOSOauthServerBundle and questions are quite old.</p>
  
  <p>I have tried using this bundle:
  <a href="https://github.com/TheFootballSocialClub/FSCOAuth2FacebookGrantBundle" rel="nofollow noreferrer">https://github.com/TheFootballSocialClub/FSCOAuth2FacebookGrantBundle</a></p>
  
  <p>but this bundle has been downloaded only 9 times before me and is not fully suited to my app (it considers that a Facebook user username equals his facebookId for instance). So I guess what I want to do is re-implement the same kind of thing my own way.</p>
  
  <p>If anyone has already done that our could provide any guidance it would be very much appreciated.</p>
  
  <p>Thank you</p>