Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you keep a user persistently logged in on an iPhone app?

On my iPhone Facebook app I think I've only logged into it once.

On my Mint financial app, I've logged in once. whenever I load it back up, I give a four digit PIN number which was setup in the app, and I never have to log in again.

I'm building an application right now where this type of behavior would be highly beneficial.

Do they just set an auth cookie of some sort and just set it to expire way into the future? Or is there another way of handling this?

Thanks!

like image 688
Jack Marchetti Avatar asked Jun 22 '11 17:06

Jack Marchetti


2 Answers

You can use the iOS KeyChain to securely store credentials as well. 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

like image 165
Matt Blackmon Avatar answered Nov 04 '22 16:11

Matt Blackmon


That depends on the context of your application. If you authenticate against another API, the supplier of the API usually provides you with some sort of authentication key which might expire after a certain time. You would store this key in your application once the user performs the authentication step and reuse it for every request.

Basically, the data you have to store and the time before your user has to re-authenticate (if ever) depends on the supplier of the API you're using.

like image 29
Philipp Avatar answered Nov 04 '22 16:11

Philipp