You can download an authentication token regardless of whether the user is logged in or not. It is stored in the session and does not change after the user logs in, and you do not need to disable authentication. I use this snippet to set a javascript variable:
<%= javascript_tag "var AUTH_TOKEN = #{form_authenticity_token.inspect};" if protect_against_forgery? %>
Caleb source share