text: Q:
  
  Authorize application, code level without hitting browser [Doorkeeper]
  
  I found a related question with no satisfactory answer, so asking here again:
  I'm using Doorkeeper GEM for API calls for my application. I have followed the steps given in oauth2 gem docs:
  require 'oauth2'
  client = OAuth2::Client.new('client_id', 'client_secret', :site => 'https://example.org')
  
  client.auth_code.authorize_url(:redirect_uri => 'http://localhost:8080/oauth2/callback')
  
  As we see the last line execution gives a URL to be used in browser and get authorization code after clicking "Authorize".
  But, I want to do all these in Rails model level, so that I don't have to hit the browser for authorization code and it should internally get the code which I can use later for token generation.
  Is it possible?
  
  A:
  
  It sounds like you want to use the resource owner password credentials flow for OAuth2. It is best described how to set this up with Doorkeeper and the OAuth2 gem in the Doorkeeper wiki.
  
  