-
Notifications
You must be signed in to change notification settings - Fork 197
Description
We're using this for our newsroom. A few reporters flagged that the bookmarklet is not working.
Reproduce:
Go to a website. Click bookmarklet. It creates a sidebar with a input form control for email and a buton that says "Login". Click an element of the page you want to monitor. Enter email address and click "Login".
The response I get is 422.
Look at logs in Heroku, I see:
2025-11-12T22:13:35.538164+00:00 app[web.1]: W, [2025-11-12T22:13:35.538141 #2] WARN -- : Can't verify CSRF token authenticity.
2025-11-12T22:13:35.538353+00:00 app[web.1]: I, [2025-11-12T22:13:35.538334 #2] INFO -- : Completed 422 Unprocessable Entity in 1ms (ActiveRecord: 0.0ms | Allocations: 220)
2025-11-12T22:13:35.538998+00:00 app[web.1]: F, [2025-11-12T22:13:35.538960 #2] FATAL -- :
2025-11-12T22:13:35.538998+00:00 app[web.1]: ActionController::InvalidAuthenticityToken (Can't verify CSRF token authenticity.):
From this information, I thought I could relax the cookie settings a bit to fix the login problem. So I forked the repo, created a file called config/initializers/session_store.rb and added the following:
Rails.application.config.session_store :cookie_store,
key: '_klaxon_session',
same_site: :none,
secure: Rails.env.production? # ensures cookie sent only over HTTPS in production
I redeployed and the 422 error goes away but the app doesn't create the new watch item. It just continually asks you to log in, says "email sent", and then when you click the link within the email, you are logged in but there is no new watch item for the element you selected previously.