Re: authenticity_token sent, still InvalidAuthenticityToken

Jason Roelofs
2008-10-10T14:22:03Z

Hmm, ok. The only other time I''ve seen this behaviour is when the
cookie for the site isn''t getting set, or is getting set with the
wrong domain. One quick test, could you compare the authenticity token
value as put in the HTML vs what gets passed in as a post parameter?

Jason

On Fri, Oct 10, 2008 at 10:05 AM, Anjan Tek
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:
>
> Hi!
>
> I am using POST, not GET.
>
> Thanks for the tip. I changed my code to use the external interface call
> from flex. But the problem persists. Even with my previous code, there
> wasn''t any problem in sending the authenticity token from flex to
rails.
> Rails is receiving the token, as shown in the log output.
>
> Processing QuestionsController#insert (for 192.170.50.67 at 2008-10-10
> 19:39:21) [POST]
>  Session ID:
> BAh7BzoMY3NyZl9pZCIlNjJiYjY0OTQ1NGQ3MWI1OWE5OWM2MTMzNzFjNzdj
> NjQiCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhh
> c2h7AAY6CkB1c2VkewA=--8e7dec53efd7dd4aaadd3c78e0b1d224e1cd55e7
>  Parameters:
{"xml_Question"=>"<error>Error</error>",
>
"authenticity_token"=>"26614e317154739eade694d4721873093f317384",
>
"temp_Image_Location"=>"http://192.170.50.67:3000/images/temp",
> "action"=>"insert",
"uuid"=>"",
"controller"=>"questions",
> "images_To_Be_Moved"=>""}
> Completed in 0.00364 (274 reqs/sec) | Rendering: 0.00011 (2%) | DB:
> 0.00000 (0%) | 200 OK [http://192.170.50.67/questions/insert]
>
> The above is the log output for the controller which works.
>
>
> The following log output is for the image upload action.
>
> Processing UploadController#upload_image (for 192.170.50.67 at
> 2008-10-10 19:39:48) [POST]
>  Session ID: 8ce910b4f637abc4a02844057c6ebc0b
>  Parameters: {"Filename"=>"France.gif",
>
"authenticity_token"=>"26614e317154739eade694d4721873093f317384",
> "temp_Image_Location"=>"/images/temp",
"action"=>"upload_image",
> "Upload"=>"Submit Query",
"controller"=>"upload",
> "random_File_Name"=>"1223647783541_517.gif",
>
"Filedata"=>#<ActionController::UploadedStringIO:0x25ee6cc>}
>
>
> ActionController::InvalidAuthenticityToken
> (ActionController::InvalidAuthenticityToken):
>
/Library/Ruby/Gems/1.8/gems/actionpack-2.1.0/lib/action_controller/request_forgery_protection.rb:86:in
> `verify_authenticity_token''
>
>
> As you can see, I''m using POST and the
"authenticity_token" variable is
> present. What worked for the first controller, is not working for the
> second. I can''t figure out why.
>
> Any insights?
>
> Thanks.
> Anjan
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>