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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:26:33+00:00 2026-06-01T13:26:33+00:00

I am trying to build a rails 3 back-end for a mobile application. However,

  • 0

I am trying to build a rails 3 back-end for a mobile application. However, I am new to creating rails 3 apps.

Users will need to have a session on the server, but I have no support for normal cookies, so I would need to send a session_id along with every request.

What kind of authentication system should I use in rails 3, is there a gem?

I have read that in rails 2 it was possible to set the session_id from the URL, but that this function is stripped from rails 3 due to security concerns. Is this even true? If there is a way to do this, I am very interested, despite the possible security holes.

  • 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-01T13:26:36+00:00Added an answer on June 1, 2026 at 1:26 pm

    Update

    A small update: Devise no longer has authentication_token as its implementation was deemed too insecure. A good alternative is Brian Auton’s suggestion.

    The summary of his method is that he generates an authentication_key AND authentication_secret in a separate model. You then authenticate by sending both your key and secret, if a match is found you are temporarily signed in as a user.

    In your application controller this looks like so:

    class ApplicationController < ActionController::Base
      before_filter :authenticate_from_token
    
      protected
    
      def authenticate_from_token
        if current_token.try :authenticatable
          sign_in token.authenticatable, store: false
        end
      end
    
      def current_token
        AuthenticationToken.find_authenticated({
          secret: (params[:secret] || request.headers[:secret]),
          secret_id: (params[:secret_id] || request.headers[:secret_id]),
        })
      end
    end
    

    The authenticatable of the token in this case is a User model, or any other thing that has been made authenticatable (the tokens are polymorphic). As you can see it can easily be made to work with Devise.

    I like this method a lot and have implemented it in a recent API. Do read up on it on his website.

    Old answer

    Outdated answer, kept for reference to older versions of Devise: Devise has a ‘authentication_token’ column which I can use for authenticating a user. I could have a login API method which I will send a username + password too, then get the token back and store that locally to sign all my other calls with. It basically is a cookie system, but one that is directly supported by Devise.

    On top of this I could re-generate the token on either every call or on every ‘session’.

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

Sidebar

Related Questions

I'm trying to build a web service using Ruby on Rails. Users authenticate themselves
I'm new to ruby/rails and trying to build a simple Projects / Tags app
I've been trying to build my first rails app and have gotten stuck on
I'm trying to build a simple product backlog application to teach myself Rails. For
I am trying to build a free web application using ruby/rails It should be
I am trying to build a very simple rails application. When user submits a
I've tried everything. I am new to rails and trying to build a simple
I am trying to build a football game using rails but have difficulty in
I'm trying to build a KML file in Rails, which I have done successfully,
I have just started learning Rails and I'm trying to build a post/like type

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.