在 api_only 模式下使用 Doorkeeper 和 Rails 时如何创建新应用程序?
How do I create a new application when using Doorkeeper and Rails in api_only mode?
我有一个 rails 5 api_only 应用程序,我正在将门卫添加为 Oauth2 提供商,也在 api_only 模式下。
当我有api_only模式时,我为doorkeeper添加了以下路由:
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 API docs 中列出的用于创建应用程序(获取我的 client_secret
等)的路由存在。
如何创建新应用程序和 get/set 我的 client_id
、client_secret
和 redirect_uri
?
我发现的一种方法(来自 Doorkeeper::ApplicationsController
)是
Doorkeeper::Application.create(name: "foobar", redirect_uri: "urn:ietf:wg:oauth:2.0:oob", scopes: ["read", "write"])
secret
和 uid
将在您保存时安全生成。
我有一个 rails 5 api_only 应用程序,我正在将门卫添加为 Oauth2 提供商,也在 api_only 模式下。
当我有api_only模式时,我为doorkeeper添加了以下路由:
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 API docs 中列出的用于创建应用程序(获取我的 client_secret
等)的路由存在。
如何创建新应用程序和 get/set 我的 client_id
、client_secret
和 redirect_uri
?
我发现的一种方法(来自 Doorkeeper::ApplicationsController
)是
Doorkeeper::Application.create(name: "foobar", redirect_uri: "urn:ietf:wg:oauth:2.0:oob", scopes: ["read", "write"])
secret
和 uid
将在您保存时安全生成。