Skip to content

Chapter 8.3 issue with CSRF when using delete to sessions#destroy #3

@dennisharrison

Description

@dennisharrison

https://github.com/learnenough/rails_tutorial_sample_app_7th_ed/blob/main/app/views/layouts/_header.html.erb#L29

snip from the console output:

Started DELETE "/logout" for 172.22.144.1 at 2022-05-21 14:13:25 -0500
Cannot render console from 172.22.144.1! Allowed networks: 127.0.0.0/127.255.255.255, ::1
Processing by SessionsController#destroy as TURBO_STREAM
Can't verify CSRF token authenticity.
Completed 422 Unprocessable Entity in 1ms (ActiveRecord: 0.0ms | Allocations: 459)



ActionController::InvalidAuthenticityToken (Can't verify CSRF token authenticity.):

actionpack (7.0.3) lib/action_controller/metal/request_forgery_protection.rb:251:in `handle_unverified_request'
actionpack (7.0.3) lib/action_controller/metal/request_forgery_protection.rb:284:in `handle_unverified_request'
actionpack (7.0.3) lib/action_controller/metal/request_forgery_protection.rb:273:in `verify_authenticity_token'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions