Closed casiodk closed 4 months ago
I have this setup in my ApplicationController
around_action :use_request_metadata private def use_request_metadata(&block) Rails.configuration.event_store.with_metadata(request_metadata, &block) end def request_metadata { current_user_id: current_user&.id, current_admin_user_id: current_admin_user&.id, request_host: request.host } end
Then I added this line
protect_from_forgery with: :exception, unless: -> { request.format.json? }
which resulted in this error when signing in through a normal rails form
ActionController::InvalidAuthenticityToken in Admin::SessionsController#create
When i remove this line around_action :use_request_metadataeverything works as expected.
around_action :use_request_metadata
@casiodk Have you tried this? https://stackoverflow.com/a/44787573
That worked :) Thanks alot! @swistak35
I have this setup in my ApplicationController
Then I added this line
protect_from_forgery with: :exception, unless: -> { request.format.json? }
which resulted in this error when signing in through a normal rails form
ActionController::InvalidAuthenticityToken in Admin::SessionsController#create
When i remove this line
around_action :use_request_metadata
everything works as expected.