Since this question was asked, the situation has changed since this device no longer has a built-in token authentication feature. It was extracted into a separate gem, deves-token_authenticatable. I use this gem and wanted to do the same as the one who asked the question.
I realized that I had to install this in my /initializers/devise.rb configuration:
config.http_authenticatable = true
I tried this through curl and it worked. In my RSpec tests, I was able to put the token in the HTTP header as follows:
user = FactoryGirl.create(:user) header = ActionController::HttpAuthentication::Token.encode_credentials( user.authentication_token) get "/api/v1/your_url", { }, { 'Accept' => 'application/json', 'Authorization' => header }
Hope this helps someone out there!
source share