Comments (15)
@HHJari Hey Jari, that is most definitely it, my issues are completely gone now.
from flutter_secure_storage.
@nicolasvahidzein Ok noted. The reason I was confused whether is a read or write issue is because @HHJari mentioned the app cannot read the data could be because the phone thinks it's still locked. Anyways, I'll give it try. Thanks!
Hi,
We have this same issue on iOS, data is being lost sometimes for users.
Could it perhaps be that if users opens the iOS app from PUSH NOTIFICATION, from lock screen, the app opens and plugin thinks phone is still locked and cannot read the data? Some race condition perhaps?
We will be trying thatfirst_unlock
option as well for our next update.
At the time I was simply speculating why the issue could happen.
from flutter_secure_storage.
But he is correct in a way. The phone is locked and because you use the wrong key for ios the values are being returned as null when the app fetches.
from flutter_secure_storage.
I think i figured it out by reading many of these issues. It is related to the iOS keychain. I added the ios permissions when i write the keys like so. I hope it helps. I will revert back in a few weeks.
//define the storage
const secureStorage = FlutterSecureStorage();
const optionsIos = IOSOptions(accessibility: KeychainAccessibility.first_unlock);
//Write value
//linked resource LR_000017
await secureStorage.write(key: 'accessToken', value: accessToken, iOptions: optionsIos);
await secureStorage.write(key: 'refreshToken', value: refreshToken, iOptions: optionsIos);
await secureStorage.write(key: 'tokenExpiration', value: expirationDate.millisecondsSinceEpoch.toString(), iOptions: optionsIos);
await secureStorage.write(key: 'tokenType', value: tokenType, iOptions: optionsIos);
from flutter_secure_storage.
Can you confirm that first_unlock
helped?
Thanks.
from flutter_secure_storage.
Hey @justprodev its hard to tell. I think its good but i do not know how to make a test to be sure.
from flutter_secure_storage.
Hi,
We have this same issue on iOS, data is being lost sometimes for users.
Could it perhaps be that if users opens the iOS app from PUSH NOTIFICATION, from lock screen, the app opens and plugin thinks phone is still locked and cannot read the data? Some race condition perhaps?
We will be trying that first_unlock
option as well for our next update.
from flutter_secure_storage.
you can skype me (nzein19) if you have any issues.
from flutter_secure_storage.
@HHJari Hey Jari, that is most definitely it, my issues are completely gone now.
Thanks for the info!
I'm building hotfix update to iOS as we speak, hopefully can roll it out in next 48h and report next week did it resolve for us.
from flutter_secure_storage.
Hi, I'm currently on flutter_secure_storage: ^9.0.0
and I have a user on iOS app experiencing data lost sometimes when launching the app. From user feedback, closing or reopening the app seems to help alleviate the issue. And this happens especially after the app have been in the background for some time. Is this what you guys have been experiencing?
from flutter_secure_storage.
Hello
yes but not data loss. Its related to data fetch when your app is running but the phone is locked. Change your persist method to first_unlock and you should be fine.
from flutter_secure_storage.
@HHJari Hey Jari, that is most definitely it, my issues are completely gone now.
Thanks for the info!
I'm building hotfix update to iOS as we speak, hopefully can roll it out in next 48h and report next week did it resolve for us.
Our iOS issues seem to be gone too with first_unlock
.
But we also noticed that Android Flutter Secure storage fails sometimes to this:
PlatformException(Exception encountered, write, java.lang.NullPointerException: Attempt to invoke interface method 'byte[] com.it_nomads.fluttersecurestorage.ciphers.StorageCipher.encrypt(byte[])' on a null object reference
at com.it_nomads.fluttersecurestorage.FlutterSecureStorage.write(SourceFile:28)
at com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin$MethodRunner.run(SourceFile:283)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.os.HandlerThread.run(HandlerThread.java:65)
, null)
Seems to be similar than this issue:
Issue #200
from flutter_secure_storage.
Sorry, just to double check. The reason why I couldn't fetch the data is because of I didn't set first_unlock
to the persist method? So, meaning I just need to set frst_unlock
for the write method while the read method remains as it is correct?
from flutter_secure_storage.
@ksyeoh yes. On the next write session to secure storage (for me it was the next time the user logged in to the system) you will see that bug on ios disappear. So do what you need to do to trigger a write of those keys once more. See my post below from a few days ago:
I think i figured it out by reading many of these issues. It is related to the iOS keychain. I added the ios permissions when i write the keys like so. I hope it helps. I will revert back in a few weeks.
//define the storage const secureStorage = FlutterSecureStorage(); const optionsIos = IOSOptions(accessibility: KeychainAccessibility.first_unlock); //Write value //linked resource LR_000017 await secureStorage.write(key: 'accessToken', value: accessToken, iOptions: optionsIos); await secureStorage.write(key: 'refreshToken', value: refreshToken, iOptions: optionsIos); await secureStorage.write(key: 'tokenExpiration', value: expirationDate.millisecondsSinceEpoch.toString(), iOptions: optionsIos); await secureStorage.write(key: 'tokenType', value: tokenType, iOptions: optionsIos);
from flutter_secure_storage.
@nicolasvahidzein Ok noted. The reason I was confused whether is a read or write issue is because @HHJari mentioned the app cannot read the data could be because the phone thinks it's still locked. Anyways, I'll give it try. Thanks!
Hi,
We have this same issue on iOS, data is being lost sometimes for users.
Could it perhaps be that if users opens the iOS app from PUSH NOTIFICATION, from lock screen, the app opens and plugin thinks phone is still locked and cannot read the data? Some race condition perhaps?
We will be trying that
first_unlock
option as well for our next update.
from flutter_secure_storage.
Related Issues (20)
- > Failed to transform android.jar to match attributes {artifactType=android-platform-attr, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}. HOT 2
- InfoSec Documentation for Windows is missing
- Question about files on Windows platform
- Getting values in separate isolate fails - Code: -25308, Message: User interaction is not allowed HOT 7
- Reading a specific key or using read all returns a null from the store HOT 1
- Running on web fails when _selectOptions are called
- Recording with encrypted data
- Linux read always empty
- Cannot compile my project with AGP >=8.0.0 due to R8 error HOT 2
- I am trying to save data but for some reason it is not saved on Flutter web (Chrome)
- app run crash on macos m1 pro HOT 2
- After reopen application, getting null values in IOS. But working in Android. HOT 10
- flutter_secure_storage for web get error: type LegacyJavaScriptObject is not a subtype of FutureOr<CryptoKey> HOT 1
- Error while reading data on windows HOT 1
- SHA-1 is a weak hash known to have hash collisions.
- App uses the encryption mode CBC with PKCS5/PKCS7 padding
- After reopen application, getting null values in IOS. But working in Android HOT 1
- Null check operator used on a null value
- iOS: Breaking Change from 9.1.x forward, causing loss of data HOT 3
- Datas are not removed when app is uninstalled - I0S HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_secure_storage.