I have a rails 4 application. I am building api for it.
I have different namespace api for my api controllers. In my main app I am using devise as authentication. I want to skip this authentication for my api.
I tried some solutions on this answer How to skip Devise authentication when using an API key?
1st I tried I made new controller
module API
class ApibaseController < ActionController::Base
end
end
then I changed my topic controller to
class TopicsController < ApibaseController
but its not working.
2nd solution
I tried
before_filter :authenticate_user!
in my topics_controller
but still not working
I am using curl for testing I tried
curl -i -X POST -d 'topic[issue]=Zombie' http://localhost:3000/topics
Its giving error inn console
HTTP/1.1 302 Found
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Location: http://localhost:3000/users/sign_in
Content-Type: text/html; charset=utf-8
Cache-Control: no-cache
X-Request-Id: e1935321-d2b4-42c3-a452-f2eb3847b4c0
X-Runtime: 0.004413
Server: WEBrick/1.3.1 (Ruby/2.1.5/2014-11-13)
Date: Tue, 21 Apr 2015 18:59:24 GMT
Content-Length: 101
Connection: Keep-Alive
Please suggest solution for my problem. Thanks in advance