Her*_*ott 5 javascript database keychain react-native expo
如何remember me通过反应应用程序进行身份验证时实现功能?我认为未加密AsyncStorage并不是最好的方法,因为数据对用户是开放的.我试图使用realm,但陷入了无法在Android中使用expo测试应用程序解决的问题.它说我需要为android编译本机代码并编辑它(在MainApplication.js中添加领域对象创建).我还不想在尚未发布的情况下编译我的项目.instagram和其他RN-apps如何存储身份验证数据?什么是最好的方法?
在private-native中存储私有数据的最佳方法是什么?
我建议使用像react-native-keychain这样的库来在react-native中存储私有数据
你可以像这样使用它:
// Generic Password, service argument optional
Keychain
.setGenericPassword(username, password)
.then(function() {
console.log('Credentials saved successfully!');
});
// service argument optional
Keychain
.getGenericPassword()
.then(function(credentials) {
console.log('Credentials successfully loaded for user ' + credentials.username);
}).catch(function(error) {
console.log('Keychain couldn\'t be accessed! Maybe no value set?', error);
});
Run Code Online (Sandbox Code Playgroud)
我希望我的回答很有帮助
小智 6
Expo.SecureStore提供了一种在设备本地加密和安全存储密钥\xe2\x80\x93值对的方法。
使用\nSecureStore.setItemAsync(key, value, options)来存储和SecureStore.getItemAsync(key, options)检索数据。
文档: https: //docs.expo.io/versions/latest/sdk/securestore
\n| 归档时间: |
|
| 查看次数: |
3632 次 |
| 最近记录: |