After setup a simple token check on the session rails spits out this
TypeError (no implicit conversion of Symbol into Integer)
app/controllers/sessions_controller.rb:21:in `verify_token'
on this method
so, as i checked seems right.
someone has any idea why this is happening on this method?
def verify_token
@current_user = User.find_by(auth_token: request.headers['token'] [:auth_token])
if @current_user
render json: {message:"verified", status: 200}
else
render_unauthorized("Token failed verification")
end
end
request.headers['token']returns an array, and you're trying to access anauth_tokenkey, hence Ruby tries a conversion from the symbol to the array index. - Sebastian Palma