Henry

Joined

100 Experience
0 Lessons Completed
0 Questions Solved

Activity

Posted in Solving Active Storage InvalidAuthencityToken Error

I have an application which is on lvh.me and i am trying to upload image using trix editor from my subdomain sample.lvh.me but for some reason i keep getting this error

Started POST "/rails/active_storage/direct_uploads" for 127.0.0.1 at 2023-11-10 12:10:07 +0000
Processing by ActiveStorage::DirectUploadsController#create as JSON
  Parameters: {"blob"=>{"filename"=>"001.jpg", "content_type"=>"image/jpeg", "byte_size"=>101505, "checksum"=>"qEG2QTZafLMiMl/TXWy6cw=="}, "direct_upload"=>{"blob"=>{"filename"=>"001.jpg", "content_type"=>"image/jpeg", "byte_size"=>101505, "checksum"=>"qEG2QTZafLMiMl/TXWy6cw=="}}}
HTTP Origin header (http://sample.lvh.me:3000) didn't match request.base_url (http://lvh.me:3000)
Completed 422 Unprocessable Entity in 7ms (ActiveRecord: 0.0ms | Allocations: 807)



ActionController::InvalidAuthenticityToken (HTTP Origin header (http://sample.lvh.me:3000) didn't match request.base_url (http://lvh.me:3000)):

Posted in How do i log user out from subdomain using devise

hi guys i am trying to build a blog platform like hashnode/substack where user register on root domain and create blog. I am currently using devise and i have set up subdomain routing. My question is that how do i only allow registration and authentication from root domain and also when in subdomain and i click logout i should be taken to root domain.

i did this in my subdomain

 <% if user_signed_in? %>
                      <li>
                        <%= form_tag(destroy_user_session_path, method: :delete, class: "block px-4 py-2 hover:bg-slate-100 dark:hover:bg-slate-600 dark:hover:text-white font-inter text-sm text-slate-600 dark:text-white font-normal") do %>
                          <button type="submit">
                            <iconify-icon icon="heroicons-outline:login" class="relative top-[2px] text-lg ltr:mr-1 rtl:ml-1"></iconify-icon>
                            Log Out
                          </button>
                        <% end %>
                      </li>
                    <% end %>

and it does not work as it only keeps refreshing