通过Doorkeeper中的命令行授权用户 [英] Authorize a User via command line in Doorkeeper
问题描述
是否可以使用Rails控制台甚至模型代码为用户授权应用程序?
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.
基本上,我希望能够在命令行上生成一个authorization_code.
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#或要关联的任何所有者类 $ app.save
$ 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.
这篇关于通过Doorkeeper中的命令行授权用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!