title: Oauth2 provider (Doorkeeper?) being an Oauth2 consumer (Devise+OmniAuth) for login
body: <p>Oauth2 is driving me crazy.</p>
  
  <p>Currently, my Rails application authenticates users through Facebook, and soon other Oauth2 providers, thanks to the beauty of Devise &amp; OmniAuth. User can't sign in with login &amp; password.</p>
  
  <p>But as my application is mainly an API, I also want it to act as an Oauth2 provider, to protect data.</p>
  
  <p>Thus, the user sign in with Facebook -> my application obtain an Access Token, and then -> provides the user a new Access Token to access my API -> my AngularJS application (or any other app) uses this token to access my API without knowing Facebook or Google Access Token.
  It looks like I need to forward Oauth2 token to client with a custom provider.</p>
  
  <p>I discovered doorkeeper gem... but I can't understand how to articulate it with Devise &amp; Omniauth.</p>
  
  <p>I found many partial answers here, but not a complete one.</p>
  
  <p>I will appreciate any help, good tutorial, or more complete answers.</p>