Giter Site home page Giter Site logo

Comments (15)

nicolasvahidzein avatar nicolasvahidzein commented on August 11, 2024 1

@HHJari Hey Jari, that is most definitely it, my issues are completely gone now.

from flutter_secure_storage.

HHJari avatar HHJari commented on August 11, 2024 1

@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.

At the time I was simply speculating why the issue could happen.

from flutter_secure_storage.

nicolasvahidzein avatar nicolasvahidzein commented on August 11, 2024 1

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.

nicolasvahidzein avatar nicolasvahidzein commented on August 11, 2024

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.

justprodev avatar justprodev commented on August 11, 2024

@nicolasvahidzein Hi

Can you confirm that first_unlock helped?

Thanks.

from flutter_secure_storage.

nicolasvahidzein avatar nicolasvahidzein commented on August 11, 2024

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.

HHJari avatar HHJari commented on August 11, 2024

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.

nicolasvahidzein avatar nicolasvahidzein commented on August 11, 2024

you can skype me (nzein19) if you have any issues.

from flutter_secure_storage.

HHJari avatar HHJari commented on August 11, 2024

@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.

ksyeoh avatar ksyeoh commented on August 11, 2024

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.

nicolasvahidzein avatar nicolasvahidzein commented on August 11, 2024

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 avatar HHJari commented on August 11, 2024

@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.

ksyeoh avatar ksyeoh commented on August 11, 2024

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.

nicolasvahidzein avatar nicolasvahidzein commented on August 11, 2024

@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.

ksyeoh avatar ksyeoh commented on August 11, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.