API を保護するために Doorkeeper gem を使用しようとしています。
私のコードは次のようになります。
初期化子/ドアキーパー.rb
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 に接続するために使用しているコマンドは次のとおりです。
RestClient.post 'http://localhost:3000/oauth/token', {
grant_type: 'client_credentials',
client_id: '26b8e5c92367d703ad35a2fc16b14dc93327a15798068ccba473aa2e3d897883',
client_secret: 'b16079915cdc20b5373f1601e31cece5a84274f772cfd89aec12c90fd110775e'
}
... と ...
RestClient.get 'http://localhost:3000/api/v1/videos', { 'Authorization' => 'Bearer <token_from_previous_request>' }
これは正常に機能しますが、私の問題は、返された Token オブジェクトに空のパラメーターがあるresource_owner_id
ことです (この列は、トークンの作成時に DB に入力されていません)。私が何を間違っているのか分かりますか?私はそれらのチュートリアルに従っています: