iOS上的存储认证令牌 [英] Storing authentication token on iOS

查看:88
本文介绍了iOS上的存储认证令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立iOS应用程序和用户与我的web服务进行身份验证。我不想让他们登录每个应用程序启动(令牌持续一个月)的时间。所以,我想某处缓存此设备。

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

推荐答案

2选项


  • 请使用<一个href=\"https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSUserDefaults_Class/Reference/Reference.html\">NSUserdefault(store作为访问令牌或文本框输入[记住我的选项])

  • 钥匙串访问(推荐)做的工作。

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

NSUserDefaults的用于存储诸如可信的值是用于在另一方面认证purpose.Keychain是不安全做成为此,安全和可靠的。

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.

这篇关于iOS上的存储认证令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆