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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:20:04+00:00 2026-05-13T18:20:04+00:00

I am trying to use the Rest-client gem to do a few small tasks

  • 0

I am trying to use the Rest-client gem to do a few small tasks for my app which uses Authlogic to authenticate users. From Rest-Client’s API, I see that one can post data necessary for the log-in process like this:

require 'rest_client'
RestClient.post "http://127.0.0.1:3000/user_sessions", {:user_session => {:username => 'myusername', :password => 'mypassword'}}.to_json, :content_type => :json, :accept => :json

Looking at my development log, I see that the app has logged in me and redirected me correctly to the user’s private page. However, when I then tried to ‘reload’ the private page,

RestClient.get 'http://127.0.0.1:3000/users/1'

I am brought back to the login page again, as if I hadn’t logged in. So I was wondering if this has to do with something called the session or cookies?

I have used cURL to reproduce this scenario successfully, where I use the switch ‘-c cookie.txt’ to save information about my having already logged in, and use the switch ‘-b cookie.txt’ for each call to tell the remote server about my authenticated-ness. I can understand this concept of like a stamp on your wrist when going in a theme-park or a bar where they know you paid. But I find no mentioning of such a mechanism in RestClient. Any help would be great to solve this. I don’t mind trying other http clients, either.

Regards

  • 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-13T18:20:05+00:00Added an answer on May 13, 2026 at 6:20 pm

    If you use Authlogic, you could be using the Single Use Token instead of user/pass. The Single Use Token is specifically for API calls like what it sounds like you’re doing here.

    See: The rdocs here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to use the rest-client gem to post something, but for some reason,
I'm trying to use an external REST Library for my application, and I'm hoping
I'm trying to use HTTPWebRequest to access a REST service, and am having problems
I'm trying to use this http://www.rcsb.org/pdb/software/rest.do REST services with Qt. I did some get
I am trying use gem tire to search in my application. I have tables
I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
I am trying use a Java Uploader in a ROR app (for its ease
This is the use case I am trying to address: I have: a client
I'm writing a small application which exposes a simple REST-ish HTTP API. I'm stuck
I'm trying to use spring rest template to do a post request. And i

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.