Alex Rivera | Logout

Storing authentication token on iOS

Asked 2012-10-03T15:55:55.177
27

I am building an iOS application and the user authenticates with my web service. I don't want them to login every time the app launches (the token lasts a month). So I'd like to cache this on the device somewhere.

What's the best way to do this, securely?

Can I just rely on the app remaining suspended and keeping the token in 'memory'?

Edit
Report

1 Answer

14

You can't rely that iOS will keep your application forever in the memory. So, you have to save the token to persistent storage at some point.

Look at Keychain Service for iOS. This is the best place to store things like passwords, tokens and other keys.

answered 2012-10-03T15:59:26.743

Your Answer