2010-12-02 90 views
0

我有Uploadify几乎与回形针和身份验证,主要使用this guide验证失败Uploadify +回形针+清除

我已经通过传递Authentication_token和会话信息作为参数并使用中间件从它们创建cookie标头,但控制器身份验证筛选器仍然失败,并且current_user不可用,从而过去了令人讨厌的InvalidAuthenticationToken错误。

有没有人有任何想法,为什么这可能是?

我通过清除插件看上去,它似乎归结为user_from_cookie方法,它认为基于饼干用户[:remember_token]

def user_from_cookie 
    if token = cookies[:remember_token] 
     ::User.find_by_remember_token(token) 
    end 
    end 

所以我想中间件还应该创建一个remember_token cookie头文件?

任何帮助将不胜感激,这对我来说证明了一点点!

回答

0

我不知道这是否是你的问题,但我碰到类似的问题,我设置了2个认证级别,一个使用基本的http和一个使用devise,会话在设计和所有方面都非常棒,但从来没有得到了基本的http ... 希望这会有所帮助。

亚历

0

传递会话密钥和价值,你的Rails应用程序应该检索与认证使用会话数据来完成。

uploadify_script_data[csrf_param] = encodeURI(csrf_token); 
uploadify_script_data[app["session_key"]] = app["session_val"]; 

$("#upload").uploadify({ 
     "swf" : "/swf/uploadify.swf", 
     "uploader" : "/upload/document.json", 
     "formData" : uploadify_script_data, 
     "buttonText" : "Upload file", 
     "method" : "post", 
     "removeCompleted": true, 
     "multi" : false, 
     "auto" : true, 
     "fileTypeDesc" : "Image", 
     "fileSizeLimit" : "1000kb" 
    }); 

对于一个详细的教程看看http://vignesh.info/blog/rails-4-uploadify-paperclip/