Search code examples
jqueryruby-on-railsrubyuploadifyauthenticity-token

Rails 3.1 authenticity_token + uploadify


I am trying to use Uploadify with my Rails 3.1 app, i've went through all the steps (middleware, initializers, config ...etc) and i think they are all working good but for one thing, my authenticity token is being "evaluated" somewhere in the process and the (+) plus signs are then turned into spaces! .. my original token is

<meta content="GS19lVJNr+/6ghijiM/hNZbo9a89I64nn1Sg+1zbqC8=" name="csrf-token" />

while the one that i see on the console is

"authenticity_token"=>"GS19lVJNr /6ghijiM/hNZbo9a89I64nn1Sg 1zbqC8="

and this of course results in "Cant' verify authenticity token" error and then the request is redirected to elsewhere.

any ideas on that? thank you.


Solution

  • do you encode it?

    If you're using something like encodeURIComponent try it like so:

    encodeURI(encodeURIComponent(token))
    

    or just try to encode/decode the token right in the firebug/chrome tools to see what's happening

    EDIT

    that's weird. Can you please show the entire scriptData you're sending?