trevorturk / flash_cookie_session

Rails 3 cookie sessions can cooperate with Flash
79 stars 16 forks source link

Still getting ActionController::InvalidAuthenticityToken #6

Closed ghost closed 13 years ago

ghost commented 13 years ago

Hi im still getting ActionController::InvalidAuthenticityToken

<% content_for :head do %>
<link href="/uploadify/uploadify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="/uploadify/swfobject.js"></script>
<script type="text/javascript" src="/uploadify/jquery.uploadify.min.js"></script>
<script src="/javascripts/upload.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
$(document).ready(function() {
  $('#video-upload').uploadify({
    uploader        : '/uploadify/uploadify.swf',
    cancelImg       : '/uploadify/cancel.png',
    auto            : true,
    multi           : true,
    script          : '/videos/',
    onComplete      : function(a, b, c, response){ eval(response) },
    scriptData      : {
            '_http_accept': 'application/javascript',
            'format' : 'json',
            '_method': 'post',
            "<%= key = Rails.application.config.session_options[:key] %>" : "<%= cookies[key] %>",
            "<%= request_forgery_protection_token %>" : "<%= form_authenticity_token %>",
            'user_id' : '<%= current_user.id %>'
          }
  });   
});
</script>
<% end %>

Using uploadify, any help would be super

Started POST "/videos/" for 127.0.0.1 at 2011-03-03 21:18:26 +0000 Processing by VideosController#create as JSON Parameters: {"Filename"=>"output.webm", "authenticity_token"=>"ezWRv/apFiZd90ImZbh9YaW4o/eKp6Nj WSXHklfnaA=", "folder"=>"/", "_myapp_session"=>"BAh7CUkiD3Nlc3Npb25faWQGOgZFRiIlOWJjODMzOWIxNmUzNzU1Mjg0NzU5YjQ1YzZiNWU3ZWFJIg5yZXR1cm5fdG8GOwBGSSIML3VwbG9hZAY7AEZJIhBfY3NyZl90b2tlbgY7AEZJIjFleldSdi9hcEZpWmQ5MEltWmJoOVlhVzRvL2VLcDZOaitXU1hIa2xmbmFBPQY7AEZJIgx1c2VyX2lkBjsARmkG--5b50afeaf603efcbdeb95f64e0c8edf61ab3e564", "_http_accept"=>"application/javascript", "user_id"=>"1", "Filedata"=>#<ActionDispatch::Http::UploadedFile:0x000001031447f0 @original_filename="output.webm", @content_type="application/octet-stream", @headers="Content-Disposition: form-data; name=\"Filedata\"; filename=\"output.webm\"\r\nContent-Type: application/octet-stream\r\n", @tempfile=#<File:/var/folders/Wp/WpyJFqKvH7Sm8zyO2YzaX++++TI/-Tmp-/RackMultipart20110303-9164-10uhe6g>>, "Upload"=>"Submit Query"} Completed in 0ms

ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken):

Rendered /Volumes/Storage/.rvm/gems/ruby-1.9.2-p136/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.7ms) Rendered /Volumes/Storage/.rvm/gems/ruby-1.9.2-p136/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (11.5ms) Rendered /Volumes/Storage/.rvm/gems/ruby-1.9.2-p136/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (18.2ms)

ghost commented 13 years ago

Ok I found the solution, my Application.config.secret_token was 128 characters long changed it too 32 and everything is working again.

Great plugin by the way trevorturk I thought it was odd that one day it was working and the next it was broken.

trevorturk commented 13 years ago

Cool - glad you figured it out! Sorry I couldn't be more help.

ghost commented 13 years ago

Seems like it only fixed it temporarily the issue is now back after a reboot, I just updated to Ruby on Rails 3.0.5 but it persists, is there anyway i can debug this?

trevorturk commented 13 years ago

Sorry, but I don't have any time to help with this. This gem is working well for me in combination with SWFUpload, but I can't say about your case. Good luck figuring it out, though! This stuff is super frustrating, I know :(