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

  • Home
  • SEARCH
  • 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 7178205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:52:26+00:00 2026-05-28T16:52:26+00:00

I want to create an iphone app where the back-end will be supported through

  • 0

I want to create an iphone app where the back-end will be supported through rails (UI-less/JSON) web service. As with other web sites out there, one of the functionalities that I will have is logging in and logging out. Right now, I am thinking about how I should architect this login functionality on iPhone and what should my rails web service do?

Anyone has any pointers on how to do this? This is what I have thought of so far.

Since my app will be the only one using this web service, I will generate a key that will be passed in for each web service call to make sure that nobody else can use this web service (no other app can use my logging in and logging out functionality).

When a user calls the login ws, I will check to make sure that the user’s login creds are valid and when they are, I will pass them a token that they will keep (how should I keep the token? I don’t think iPhone has session) and they will have to call another web service passing the token/email/pass to signal the ws that the client has gotten the key.

For each restricted ws call, the user will need to pass the token to call the service.

When the user log out, the token will be invalidated.

Basically I just copied OAuth mechanism or something like that. My biggest question is how can I keep the token around on the client’s end (iPhone).

  • 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-28T16:52:27+00:00Added an answer on May 28, 2026 at 4:52 pm

    You can use NSUserDefaults to store the token, you set a key and store and retrieve against that key.

    When the user logs out you can just clear the NSUserDefault for that key.

    -(void)saveToUserDefaults:(NSString*)myString
    {
        NSUserDefaults *standardUserDefaults = [NSUserDefaults standardUserDefaults];
    
        if (standardUserDefaults) {
            [standardUserDefaults setObject:myString forKey:@"LoginAuthToken"];
            [standardUserDefaults synchronize];
        }
    }
    
    -(NSString*)retrieveFromUserDefaults
    {
        NSUserDefaults *standardUserDefaults = [NSUserDefaults standardUserDefaults];
        NSString *val = nil;
    
        if (standardUserDefaults) 
            val = [standardUserDefaults objectForKey:@"LoginAuthToken"];
    
        return val;
    }
    

    References;

    http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSUserDefaults_Class/Reference/Reference.html

    http://www.cocoadev.com/index.pl?NSUserDefaults

    If you want to store the username and password for your web service, you should use ios Keychain access to keep it secure.

    Reference;

    http://developer.apple.com/library/mac/#documentation/security/conceptual/keychainServConcepts/02concepts/concepts.html

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

Sidebar

Related Questions

I want to create an iPhone app which makes calls to a web service.
I want to create an iPhone app that displays (among other things) a specific
I want to create an Ipad/iPhone app that will act as a catalog to
I want to create an Event Calendar for my iPhone App. In a first
I want to create an extremely simple iPhone program that will open a telnet
I want to create an iphone app for personal use. Can I just put
I want to create a page flipping transition for an iPhone app like the
Trying to create an iPhone app (Objective-C) for my school. I want it to
My iPhone app currently uses core data. I want to create an online database
I'm trying to create an iPhone app using xcode, and I want to know

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.