I'm trying to build an API using rails to use with an Android App, I've configured Devise and Doorkeeper, but I guess I forgot something...
I have this code in my controller:
doorkeeper_for :all
protect_from_forgery with: :null_session
respond_to :json
In the header
Authorization: Bearer b92d41ffd0723a77fcb8acd03e6e5be3b2f3036f07c9619f5bfb62611e31f42d
When I use GET method it works, but POST or DELETE don't
I get this error when I try to do a POST in my controller
{"error": "You need to sign in or sign up before continuing."}
Any suggestions?
Update
doorkeeper.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
I have made no changes in default values of Devise