Is it possible to authorize a User for an Application using the Rails console, or even model code?
In certain situations, I want to be able to create and authorize a new user account for a particular application.
Essentially I want to be able generate an authorization_code on the command line.
You need to disable the confirmation feature for the app owner:
$ app = Doorkeeper::Application.new :name => 'test', :redirect_uri => 'http://test.com'
$ app.owner = User.last # Or any owner class that you want to be associated
$ app.save
Take a look on the documentation for further details.
Not sure its the best way to do it, but by manually creating a Doorkeeper::AccessGrant, with the proper associations you can get an authorization code from it.