Authorize user via command line in Doorkeeper
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 specific application.
Essentially, I want an authorization_code file to be generated on the command line.
0
Greg olsen
source
to share
2 answers
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 whatever owner class you want to bind $ app .save
For details see.
+1
Paulo henrique lellis gonalves
source
to share
Not sure if this is the best way to do it, but by manually creating Doorkeeper :: AccessGrant, with the appropriate associations, you can get the authorization code from it.
0
Greg olsen
source
to share