Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7893091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:02:12+00:00 2026-06-03T07:02:12+00:00

I have a simple rails webpage where a user enters in a few textfields

  • 0

I have a simple rails webpage where a user enters in a few textfields and uploads a picture. Rails then stores the picture and updates the databases on the server. It works fine.

However, I also need a script on another computer to update the web page occasioanlly using the curl/curb libraries. When i try to do that, though, I get this error:

ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken)

When I look closer, it seems that rails puts in a hidden field called “authenticity_token” whenever it creates a form:

<form action="/headshots/single" enctype="multipart/form-data" method="post">
<input name="authenticity_token" type="hidden" value="798b514826513c881613a0c18b52839489a12181" />
. . .
</form>

The curb script won’t work because it doesn’t have the “authenticity_token” thing. Is there any way around this? Maybe make another webpage that does the same thing, but just for my curb script?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:02:13+00:00Added an answer on June 3, 2026 at 7:02 am

    The hidden input is there to prevent Cross-Site Request Forgery. You can’t make a post to a rails action which is so protected without first getting the form and extracting the hidden authenticity_token parameter. curl isn’t clever enough to do this on its own.

    You have two options:

    1. turn off the CSRF protection by removing the call to protect_from_forgery from your controller(s). Bad Idea.
    2. run one request to get the form, use a quick-and-dirty regex to get the paremeter, say

      /name="authenticity_token".*value="([^"]+)"/

      and then run another request posting that value for authenticity_token. It’s brittle and it might make people hate you but it will work.

    3. Use something more sophisticated than curl to make the necessary request for the form and the successive submission. Mechanize appears to be the de facto standard.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple rails app where user can send a mass email to
We have implemented a simple chat room feature in Rails using Simple Ajax updates.
I have a simple Rails 3 blog app that needs an admin user so
I have a simple rails application with a few controller and some rake tasks.
I have a simple rails 2.3.4 application I am trying to get running with
I have a really simple Rails app. Basically an article with comments. I want
I have a very simple Rails app with a very simple relational database: Category
I am new to rails and have developed a simple rails application on my
I have a simple Ruby on Rails form which includes an authenticity_token. Unfortunatly, I
I have a simple problem regarding a loop in a Rails controller. Here's the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.