Set auth header to rails link_to path

I need to add an auth header to the request. I tried to add:

:headers => $auth_headers 

In the method:

link_to("Verify", agency_verify_path(agency), :method => :put, :headers => $auth_headers) 

Token authentication failed.

+4
source share
1 answer

You cannot set headers in link_to.

Create a controller action that sets the correct headers and redirects the user to the destination.

Also, prefer auth_headersor @auth_headersover $auth_headers.

0
source

Source: https://habr.com/ru/post/1607883/


All Articles