My understanding of the authentication for hyperstack is that it leans on the session for persisting the user's id, which is used to fetch the acting_user
.
If I wanted to decouple from the rails session, and use token based authentication, how can I setup the Hyperstack transport to include a token with every request?
Basically what I'm asking is how can I send a token such that it's available in the acting_user
call.
class ApplicationController < ActionController::Base
def acting_user
claim = JsonWebToken.verify(params[:token], key: some_key)
@current_user ||= claim[:ok] && User.find(claim[:ok][:user_id])
end
end
where params[:token]
is being passed from the client on a request.