首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >resource_owner_id未被填充

resource_owner_id未被填充
EN

Stack Overflow用户
提问于 2013-11-22 18:20:11
回答 1查看 1.3K关注 0票数 1

我正在尝试使用Doorkeeper来保护我的API。

我的代码如下所示:

初始化器/门键.

代码语言:javascript
复制
Doorkeeper.configure do
  resource_owner_authenticator do
    current_user || warden.authenticate!(:scope => :user)
  end

  default_scopes :public # if no scope was requested, this will be the default
  optional_scopes :admin, :write

  enable_application_owner :confirmation => false
end

下面是我用来连接到API的命令:

代码语言:javascript
复制
RestClient.post 'http://localhost:3000/oauth/token', {
  grant_type: 'client_credentials',
  client_id: '26b8e5c92367d703ad35a2fc16b14dc93327a15798068ccba473aa2e3d897883',
  client_secret: 'b16079915cdc20b5373f1601e31cece5a84274f772cfd89aec12c90fd110775e'
}

..。还有..。

代码语言:javascript
复制
RestClient.get 'http://localhost:3000/api/v1/videos', { 'Authorization' => 'Bearer <token_from_previous_request>' }

它工作得很好,但我的问题是返回的令牌对象有一个空的resource_owner_id param (这个列没有在令牌创建的DB中填充)。你知道我做错了什么吗?我一直在学习这些教程:

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-02-27 00:22:39

客户端凭据流“不与资源所有者(https://github.com/applicake/doorkeeper/wiki/Client-Credentials-flow)相关联”,因此我认为没有设置resource_owner_id是正确的。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20151815

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档