Rails を使用して Android アプリで使用する API を構築しようとしています。Devise と Doorkeeper を構成しましたが、何かを忘れていたようです...
コントローラーに次のコードがあります。
doorkeeper_for :all
protect_from_forgery with: :null_session
respond_to :json
ヘッダー内
Authorization: Bearer b92d41ffd0723a77fcb8acd03e6e5be3b2f3036f07c9619f5bfb62611e31f42d
GET メソッドを使用すると機能しますが、POST または DELETE は機能しません
コントローラーで POST を実行しようとすると、このエラーが発生します
{"error": "You need to sign in or sign up before continuing."}
助言がありますか?
アップデート
ドアキーパー.rb
Doorkeeper.configure do
orm :active_record
resource_owner_authenticator do
current_usuario || warden.authenticate!(:scope => :usuario)
end
resource_owner_from_credentials do |routes|
request.params[:usuario] = {:email => request.params[:username], :password => request.params[:password]}
request.env["devise.allow_params_authentication"] = true
request.env["warden"].authenticate!(:scope => :usuario)
end
end
Deviseのデフォルト値を変更していません