Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storing authentication token on iOS

Tags:

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'?

like image 235
ConfusedNoob Avatar asked Oct 03 '12 15:10

ConfusedNoob


1 Answers

2 options

  • Make use of NSUserdefault(store as access token or textfield inputs[Remember me option])
  • Keychain access(recommended) for doing the job.

NSUserdefaults is not secure for storing such credible values which is for authentication purpose.Keychain on the other hand is made to do this,safe and secure.

like image 87
Lithu T.V Avatar answered Oct 04 '22 18:10

Lithu T.V