How do you permanently save a user in the iPhone application?

In my iPhone Facebook application, I think I only logged into it once.

In my Mint financial app, I logged in once. whenever I download it back, I give the four-digit PIN that was configured in the application and I no longer need to log in.

I am creating an application right now when this type of behavior will be very useful.

Do they just set some kind of cookie, and just set it in the future? Or is there another way to handle this?

Thanks!

+7
source share
4 answers

You can use iOS KeyChain to securely store credentials. This can be simplified by using this code found on github ( https://github.com/ldandersen/scifihifi-iphone/tree/master/security/ ), with some basic instructions found at http://gorgando.com/blog / tag / sfhfkeychainutils

+6
source

It depends on the context of your application. If you are authenticating with another API, the API provider usually provides you with some kind of authentication key that expires after a certain time. You would save this key in your application after the user completes the authentication step and reuses it for each request.

Basically, the data you need to store and the time before your user needs to re-authenticate (if ever) depends on the provider of the API you are using.

+3
source

I can't speak for Facebook or Mint, but the easiest approach is to use a cookie / token and store it in NSUserDefaults.

When the application is running, check if the token is saving. If this is not valid, force the user to log in again.

+2
source

I take a hit in the dark here, but:

I assume that the login information is encrypted and then stored on the device somewhere. After creating a new instance of the application, this data is sent to the site for all oauth / login / etc files. Once this is done, the Facebook application will remain on until: 1) the device is turned off or 2) you manually exit the application.

This may help you, but I'm sure the best answers will come.

+1
source

All Articles