Open hugobast opened 7 years ago
If someone comes here in search of answers as to why the headers are disappearing on the second request this is because devise mappings for a nested resource will have warden work with something that isn't :user
. In my case I had warden map with api_user
because it was namespaced under api
. A fix for this looks simple here's what I did to my routes:
namespace :api, as: nil do
end
as: nil
ensure that we won't get a namespaced resource mapping!
I think there's an issue at this line: https://github.com/mcordell/grape_devise_token_auth/blob/90d24291e16d7656059eaba933302136dc49abbd/lib/grape_devise_token_auth/auth_headers.rb#L6
This assumes that warden keeps track of the user using
:user
.While this helper: https://github.com/mcordell/grape_devise_token_auth/blob/master/lib/grape_devise_token_auth/auth_helpers.rb
Has it dynamically set.