RStudio when launched without Singularity is having strange troubles with authentication

If you need to pass something back to the view (like the csrftoken) you can use conn_params for this.

https://osc.github.io/ood-documentation/latest/reference/files/submit-yml/basic-bc-options.html

# submit.yml
conn_params:
  -  csrf_token
# before.sh.erb
# this may actualy be case sensitive, so maybe csrf_token would work
export CSRF_TOKEN="<$= SecureRandom.uuid >"

Then you can use it directly in your view.html.erb like you use host/port and so on.

  document.cookie = "csrf-token=<%= csrf_token %>;

Once you export the variable in the before script, it should get written automatically to connection.yml. It may be problematic to write or rewrite that file, so it’s probably safer to use this mechanism conn_params.