- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
感谢这个伟大的图书馆。
我在我的一个 react-native 项目中使用这个库,但是每当我试图获取存储在 keychain 中的值时,都会在 iOS 中返回 undefined 。
Here is what is my use case
1-We have an existing "Native iOS App", which is already present in AppStore to download.
2-Now my client is redeveloping the same app in React-Native, and want to provide this new app as an update to existing users.
3-So we are keeping "Bundle ID" of our new (react-native app) same as that of older app (iOS native app), with higher version number ,so that our new will be downloaded as an updated.
4-Let's suppose, an existing user is already logged in the older app, so we want to maintain this logged status , whenever user update app with newer one.
5-In older app (iOS native app), we are saving "Access Token" in keychain, so based on whether "Access Token" is present in keychain, we decide the logged in status of user
6-Now, in newer app (react-native), we have to get that same "Access Token" from keychain, so that we can decide the logged in status of user and can navigate the user to appropriate screen.
I hope that makes sense!
Now when I am using this library, and try to get "Access Token" from keychain, its returning "undefined" in iOS.
Here may be I am doing something wrong, which only you guys can figure out.
This is how I am trying to get saved "Access Token".
SInfo.getItem("AccessToken", {}).then(value => {
alert(value);
console.log("access token is", value); // value1
});
最佳答案
我面临着类似的问题,我弄清楚发生了什么,我敢打赌我们在同一条船上。
我正在使用 react-native-sensitive-info
为了存储 JWT,不是像您这样简单的 key ,而是来自 reducer (redux),因此路径是 authentication.jwt
我期待按原样查询它,但它返回 undefined
经过一番调查,我发现 getItem
的key,指的是你在配置store的时候给的key。
例如,我正在这样配置它:
const persistConfig = {
key: 'root',
transforms: [saveJwtOnly],
whitelist: ['authentication'],
storage
}
const persistedReducer = persistReducer(persistConfig, rootReducer)
key: 'root'
.现在,
react-native-sensitive-info
在它前面加上
persist:
这样就我而言,唯一可用的 key 是
getItem
就能返回是
persist:root
,它返回我存储的
authentication.jwt
的 JSON和
_persist
包中的 key 。
关于尝试从钥匙串(keychain)中获取保存的数据时,react-native-sensitive-info 给出 undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44387984/
这被要求作为这个 SO 的跟进: Add a keychain to search list? 我们知道如何通过以下方式将新创建的钥匙串(keychain)添加到搜索列表中: security lis
我一直在尝试在 iPhone 应用程序中使用持久钥匙串(keychain)引用。我发现如果我创建了两个不同的钥匙串(keychain)项目,我每次都会得到不同的持久引用(它们看起来像“genp....
无论我使用哪个访问组,我都无法在 iOS 模拟器上的 Keychain 中保存数据。使用真实设备一切正常。是否可以在模拟器上使用钥匙串(keychain)? 顺便说一句,我使用 SwiftKeycha
直到 Xcode 8/iOS 10,我才能够从静态库的单元测试中访问钥匙串(keychain)。升级后,出现错误,请参阅堆栈跟踪: failed: caught "NSInternalInconsis
我正在开发一个应用程序,我需要使用钥匙串(keychain)存储和检索用户数据,如(用户名、密码、url、域名等)。但我发现有可用的预定义键,例如(kSecAttrAccount、kSecAttrDe
有5 types of keys可以存储在 iOS 钥匙串(keychain)中 kSecClassGenericPassword kSecClassInternet 密码 kSecClassCert
我们有一个启动守护进程(出于各种原因,它必须以 root 身份运行),并通过网络与服务器组件进行通信。它需要通过服务进行身份验证,因此当它第一次获取密码时,我们将其保存到系统钥匙串(keychain)
我使用 iOS keychain wrapper 编写了一个项目存储用户名和密码,项目工作正常,直到昨天。 在我对项目运行 clean 命令后,项目崩溃: - (void)writeToKeychai
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
为了授予快速用户身份验证,想法是使用 wifi(企业)网络的相同凭据。是否可以从应用程序获取用于网络访问的用户/密码? 我的意思是,以编程方式访问设备钥匙串(keychain)? 最佳答案 从此app
我实现了这段代码 https://github.com/exchangegroup/keychain-swift使用钥匙串(keychain)。我作为一个该死的初学者的问题: 我使用 parse.co
这一切都发生在我的模拟器中。在练习使用钥匙串(keychain)包装时,我发现自己处于一种奇怪的情况。我试图学习如何从钥匙串(keychain)插入和检索数据,为了做到这一点,我开始了一个新项目,其中
我一直在阅读该文档,但我感到困惑。 有iOS钥匙串(keychain)here . 还有 iCloud 钥匙串(keychain) here . 它们都称为钥匙串(keychain),都能够本地存储并
我最近买了一台新的 Macbook Pro,并将我的旧数据迁移到了它上面。从那时起,Xcode 拒绝在物理设备上构建。模拟器工作正常(因为我认为它不需要代码签名)。 我收到的错误是这样的:“在钥匙串(
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a softwar
我正在脚本中运行 xcodebuild 来存档和导出我的项目。我正在使用钥匙串(keychain)文件进行代码签名。为了避免提示输入钥匙串(keychain)密码,我使用 security unloc
我正在使用 KeychainItemWrapper 类(项目中集成的 .h 和 .m 文件)在 Keychain for iOS App 中保存密码。还在项目中需要的地方导入“安全”框架和“keych
我正在尝试使用 Jenkins 打包一个 iOS ipa。所以我得到了 Keychains and Provisioning Profiles Management 插件并尝试上传它需要的钥匙串(ke
我在调用 SecItemAdd 时没有找到有关此类错误代码的信息,可能是什么原因造成的? 提前致谢 编辑:这是我得到错误的函数: + (BOOL)storeWithKey:(NSString *)ke
我正在尝试签署 iPhone 应用程序以供发布,因此我按照说明进行操作。无论如何,在创建我的证书签名请求时,我从钥匙串(keychain)访问中收到此错误:“找不到默认钥匙串(keychain)” 我
我是一名优秀的程序员,十分优秀!