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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:07:47+00:00 2026-05-30T11:07:47+00:00

What is the correct way of making persistent session with RestKit? The most simple

  • 0

What is the correct way of making “persistent” session with RestKit?

The most simple way is to make long session at the server side, but
not sure it’s safe for browser version. I prefer to implicitly re-
login if session is expired, but in this case I have to handle session
expiration, send new login request, receive response and than send
again a target request. Sources become more complicated.

Is there any features in the RestKit which allows manage that
automatically? Maybe just keep persistent session for iPhone app and
short one for web version using features of CakePHP?

Thanks,
Victor

  • 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-30T11:07:50+00:00Added an answer on May 30, 2026 at 11:07 am

    You probably want the session in order to for authentication/authorization to work?

    I’m currently working on a RestKit project on iOS. For my needs, what I did was very close to the discussionboard example by RestKit’s creators.

    in iOS, you can write a uniqueSecurityToken to NSUserDefaults. It can be a property model of your user model on the iOS app. On Rails (Im making an assumption), if you have a auth gem like Authlogic/Sorcery, it’s very easy to either override the current_user method or assigning one based on token.

    For example,

    def user_access_token 
        request.headers["HTTP_X_USER_ACCESS_TOKEN"] || request.headers["HTTP_USER_ACCESS_TOKEN"]
    end
    
    def check_for_mobile_token
        if token = user_access_token
          current_user = User.find_by_remember_me_token(token) || current_user
        end
      end
    

    You can call a before filter to make sure that the authentication is always checked. on the IOS side, tell RestKit to send the uniqueSecurityToken as HTTP_USER_ACCESS_TOKEN in the headers. Note that this is probably not the most secure method, you should at least have HTTPS so that the transport is encrypted.

    Here’s the RestKit Discussion Board Project (very useful for RestKit/IOS)
    https://github.com/RestKit/RKDiscussionBoard

    Here’s a Rails Presentation that outlines Rails/iOS integration
    http://www.slideshare.net/maximeguilbot/rails-as-ios-application-backend

    If you’re using another REST framework other than Rails, you can reference the JSON techniques too.

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

Sidebar

Related Questions

What's the correct way of making checkboxes that are related to a certain question
Similar to this question: Checkboxes on Rails What's the correct way of making radio
Which is the correct way of making strlen return the lenght of several strings
What is the correct way to import a C++ class from a DLL? We're
What is the correct way to do this? For example, how would I change
What is the correct way to check if a value is a date/number in
Is there a correct way in Windows Forms to flash a titlebar without having
What is the correct way to convert ASP.NET SOAP-based web services to JSON-based responses?
What is the 'correct' way to store a native pointer inside a Java object?
What is the correct way of retrieving maximum values of all columns in a

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.