[英]How do I create a new application when using Doorkeeper and Rails in api_only mode?
I have a rails 5 api_only app and I'm adding doorkeeper as an Oauth2 provider, also in api_only mode. 我有一个Rails 5 api_only应用程序,并且我正在以api_only模式将Doorkeeper添加为Oauth2提供程序。
When I have api_only mode, I have the following routes added for doorkeeper: 当我具有api_only模式时,我为门卫添加了以下路由:
Prefix Verb URI Pattern Controller#Action
native_oauth_authorization GET /oauth/authorize/native(.:format) doorkeeper/authorizations#show
oauth_authorization GET /oauth/authorize(.:format) doorkeeper/authorizations#new
DELETE /oauth/authorize(.:format) doorkeeper/authorizations#destroy
POST /oauth/authorize(.:format) doorkeeper/authorizations#create
oauth_token POST /oauth/token(.:format) doorkeeper/tokens#create
oauth_revoke POST /oauth/revoke(.:format) doorkeeper/tokens#revoke
oauth_introspect POST /oauth/introspect(.:format) doorkeeper/tokens#introspect
oauth_token_info GET /oauth/token/info(.:format) doorkeeper/token_info#show
None of the routes listed in the API docs for creating applications (to get my client_secret
, etc.) are present. API文档中列出的用于创建应用程序(获取我的
client_secret
等)的路由均不存在。
How do I create a new application and get/set my client_id
, client_secret
, and redirect_uri
? 如何创建新应用程序并获取/设置我的
client_id
, client_secret
和redirect_uri
?
One way I've found (from the Doorkeeper::ApplicationsController
) is 我发现的一种方法(来自
Doorkeeper::ApplicationsController
)是
Doorkeeper::Application.create(name: "foobar", redirect_uri: "urn:ietf:wg:oauth:2.0:oob", scopes: ["read", "write"])
the secret
, and uid
will be securely generated when you save. 保存时将
secret
生成secret
和uid
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.