2011-06-05 176 views
1

當我訪問我的facebook iframe應用程序時出現此錯誤:Rails Facebook iframe應用程序錯誤:InvalidAuthenticityToken

The change you wanted was rejected. 

Maybe you tried to change something you didn't have access to. 

Heroku日誌:

2011-06-05T08:30:41+00:00 app[web.1]: Started POST "/facebook/" for xxxx 
03 at 2011-06-05 10:30:41 +0200 
2011-06-05T08:30:41+00:00 heroku[router]: POST www.vinderhimlen.dk/facebook/ dyn 
o=web.1 queue=0 wait=0ms service=39ms bytes=711 
2011-06-05T08:30:41+00:00 app[web.1]: 
2011-06-05T08:30:41+00:00 app[web.1]: ActionController::InvalidAuthenticityToken 
(ActionController::InvalidAuthenticityToken): 
2011-06-05T08:30:41+00:00 app[web.1]: 
2011-06-05T08:30:41+00:00 app[web.1]: 
2011-06-05T08:30:41+00:00 app[web.1]: 
2011-06-05T08:30:45+00:00 heroku[web.1]: Stopping process with SIGTERM 
2011-06-05T08:30:45+00:00 app[web.1]: >> Stopping ... 
2011-06-05T08:30:45+00:00 heroku[web.1]: Process exited 

[email protected] /c/rails/konkurranceportalen (master) 
$ 

回答

1

默認情況下,Rails的要求被列爲令牌每個POST都有一個隱藏字段。

這可以保護您的應用程序免受跨網站請求僞造。

請參閱導軌Request Forgery Protection文檔。

skip_before_filter :verify_authenticity_token對於進一步的調試可能是有用的。

+0

我已經加入skip_before_filter:verify_authenticity_token它仍然給出了同樣的錯誤 – 2011-06-05 11:00:20

+0

嘗試從控制器/ application_controller.rb – 2011-06-05 11:25:02

+0

現在,它的工作原理去除'protect_from_forgery':) – 2011-06-05 12:02:05