我正在尝试使用devise (3.4.1) + doorkeeper (2.4.1) + Rails 4.2构建一个api,当我尝试连接我的前端应用程序时,我一直收到错误消息"The Authorization server not support this response type“,下面是来自控制台的转储:
Started GET "/oauth/authorize?response_type=token&client_id=a91f8fea40322739310b0db9ee3e3d53878bff0df073f3aa36af7da4f99b365e&r
我正在学习如何为rails应用程序开发API。我正在尝试开发它用于移动应用程序。到目前为止,我为大多数控制器开发了一个小api。但是我在登录时遇到了问题。我使用devise进行用户管理,使用rails 4.1。
我观看了实现的铁路广播视频。但在视频中,他们在oauth gem中使用了doorkeeper。我想在没有oauth的情况下实现它。我该怎么做呢?
到目前为止,我添加了doorkeeper gem,并在initialize文件夹中使用以下代码添加了doorkeeper.rb
Doorkeeper.configure do
resource_owner_authenticator do
按照看门人github自述的指示(我想),我得到了尽可能多的before_action。
class ReadingsController < ApplicationController
before_action :doorkeeper_authorize! # Require access token for all actions
...
end
RubyMine抱怨:doorkeeper_authorize!没有在作用域中定义。不管怎么说,我会得到:
Processing by ReadingsController#index as HTML
Filter chain hal
有两个名称空间:
api/public
api/mobile
在公共控制器中创建具有适当范围的门卫授权。例如:
class API::Public::PostsController < ApplicationController
before_action -> { doorkeeper_authorize! :public }
def show
@post = Post.find(params[:id])
end
end
移动命名空间中的控制器是从公共命名空间中的控制器继承的。例如:
class API::Mobile::PostsController &l
在回拨process_action回调之前,我收到了错误。
:doorkeeper_authorize! has not been defined
在安装rails admin之后,我开始得到这个错误。
class Api::V1::User::UsersController < Api::ApiApplicationController
skip_before_action :doorkeeper_authorize!, only: %i[create]
def create
user = User.new(user_params)
end
end
我正在我的应用程序中实现OAuth 2,我已经有了登录/刷新令牌,但我在注销时遇到了一些问题。
我有一组由Doorkeeper生成的路由:
Routes for Doorkeeper::Engine:
authorization GET /authorize(.:format) doorkeeper/authorizations#new
authorization POST /authorize(.:format) doorkeeper/authorizations#cre
我正在尝试设置Door门将,以使我的表Company拥有Access和Grant令牌。我在跟踪,但我使用的是公司而不是用户作为资源所有者。
这是在我接受预授权提示并被发送到/oauth/authorize之后所得到的错误
ERROR: insert or update on table "oauth_access_grants" violates foreign key constraint "fk_rails_330c32d8d9"
DETAIL: Key (resource_owner_id)=(2) is not present in table
我正在为我的一个Rails应用程序设置和。我的目标是允许用户根据他们的access_token访问api,这样只有用户才能看到他们的'user_show‘json。到目前为止,我已经在“OAuth2/ applications”路线上设置和授权了我的开发和生产应用程序。
我的'/config/initializers/doorkeeper.rb‘
Doorkeeper.configure do
# Change the ORM that doorkeeper will use.
# Currently supported options are :active_reco
当我在rails应用程序中使用时,我得到了一个奇怪的错误。下面是我的doorkeeper.rb文件的样子:
Doorkeeper.configure do
# Change the ORM that doorkeeper will use (needs plugins)
orm :active_record
# This block will be called to check whether the resource owner is authenticated or not.
resource_owner_authenticator do |routes|
我有一个使用devise 4.7.1,doorkeeper 5.5.1和devise-doorkeeper 1.2.0的Rails 6.1应用程序。 我正在尝试运行一个(PKCE) OAuth流,但是最后一步--对/oauth/token的POST请求--返回了一个401未授权的JSON content {"error": "You need to sign in or sign up before continuing."}错误。 我对此感到困惑,因为据我所知,未经身份验证的用户应该可以访问/oauth/token端点。同样奇怪的(但可能是转移注意力的)是,
我很难理解Oauth的验证。我正在尝试使用bing的搜索api。他们要求oauth核实。我有他们给我的主钥匙。我遇到的问题是如何提出请求,提供oauth验证密钥。
例如,如果我试图通过以下方法发出get请求:
http//api.datamarket.azure.com/Bing/Search?Query=%27xbox%27
我收到一个错误
The authorization type you provided is not supported. Only Basic and OAuth are supported
所以问题是,我是否将我的密钥嵌入到URL中,比如
http//api.da