jpegcam (paperclip, 다음은 these directions)이라는 javascript를 사용하고 있으며 다른 경우 CSRF 토큰이 잘못 생성됩니다. 이 문제가있는 유일한 곳입니다. 나쁜 토큰에는 중간에 '+'문자가 있습니다. (페이지 뷰)레일즈 - 경고 : CSRF 토큰 진위를 확인할 수 없습니다.
Started POST "https://stackoverflow.com/users/upload?authenticity_token=N0x/rDOgyC6AutbXzx8sZXLwDnB9zQ+NwWefXTpiSfE=" for 127.0.0.1 at 2013- 06-04 01:06:34 -0400
...
Parameters: {"authenticity_token"=>"N0x/rDOgyC6AutbXzx8sZXLwDnB9zQ NwWefXTpiSfE="}
WARNING: Can't verify CSRF token authenticity
...
Completed 401 Unauthorized in 15ms
JS 다음과 같습니다 :
<script type="text/javascript">
function onload_complete(msg) {
// fetch the CSRF meta tag data
var csrf_param = $('meta[name=csrf-param]').attr('content');
var csrf_token = $('meta[name=csrf-token]').attr('content');
// reset the api URL appending the auth token parameter
webcam.set_api_url('<%= upload_users_path %>' + '?' + csrf_param + "=" + encodeURI(encodeURI(csrf_token)));
}
...
</script>
감사합니다 도움이되기를 바랍니다! 'webcam.set_api_url ('<% = upload_users_path %>'+ '? csrf_param + "="+ encodeURI (encodeURI (csrf_token))) "라인의 문제처럼 보입니다. 어떻게 든 혼합. –