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 3805220
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T14:38:34+00:00 2026-05-19T14:38:34+00:00

I want to test my rails web service using cURL, yet so far I

  • 0

I want to test my rails web service using cURL, yet so far I could only do it while deactivating before_filter :authenticate_user!. But I’d like to log in a priori and then create, destroy etc.

I saw that with cURL you can authenticate and save the session info in a cookie, that you use for your following requests, yet I couldn’t make it work with Devise: in my scenario, the user logs in using an email/password combination, so I’m trying:

curl \
  -X POST \
  -d 'email=email@example.com&password=password' \
  -c cookie \
  http://localhost:3000/users/sign_in > out

and I get: ActionController::InvalidAuthenticityToken in Devise/sessionsController#create

Could somebody give me an idea / an example?

Thanks!

  • 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-05-19T14:38:35+00:00Added an answer on May 19, 2026 at 2:38 pm

    This works:

    Authenticate:

    curl -H 'Content-Type: application/json' \
      -H 'Accept: application/json' \
      -X POST http://localhost:3000/users/sign_in \
      -d "{'user' : { 'email' : 'test@example.com', 'password' : 'password'}}" \
      -c cookie

    Show:

    curl -H 'Content-Type: application/json' \
      -H 'Accept: application/json' \
      -X GET http://localhost:3000/pages/1.xml \
      -b cookie
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to test the age of a user of my Rails application using
I want to test the REST api on my Rails site. What is the
I use the latest oauth-plugin with Rails 3.1. I want to test my OAuth2
I have been learning Ruby lately, and I want to upload a test web
I want to test the profile usage of an important library-class of my rails-project.
I'm using RSpec 1 and rspec-rails to test my Rails 2.3.14 application. In this
I'm trying to use RSpec to test a Rails 3.1rc4 project. I want to
I want to test my RESTful resource in Rails: require 'rubygems' require 'activeresource' class
I'm developing a Rails 3 app locally on my Mac. I want to test
I want to test if my 'style.css' is linked to my page while rendering

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.