Giter Site home page Giter Site logo

Comments (7)

JSBmanD avatar JSBmanD commented on August 11, 2024

Found this property accessibility: KeychainAccessibility.first_unlock_this_device,
but it doesn't have always accessibility. I think it's a feature request now.
Use case: push is received when phone is locked and just restarted (after power was drained and device is on charge). Callback in push isolate is calling backend to confirm push delivery in our system. Request doesn't have access token.

from flutter_secure_storage.

btrautmann avatar btrautmann commented on August 11, 2024

I'm running into a similar issue, though not from an isolate. I use flutter_background_fetch to periodically update Home Widgets. Part of this update process is to fetch new data for the user from the server (requiring their access/refresh token to be pulled from storage). This seems to fail with the error mentioned in this issue and this one (which seem similar/the same).

It's worth noting that once I return to the app, I go through the same codepath to retrieve the access/refresh tokens and the same error is thrown, so it seems the initial background read borks the storage retrieval entirely until I force-quit the app (swiping up from recents) and start the app again.

In case it helps, the retrieval code looks like:

    final accessToken = _storage.read(key: _accessTokenKey);
    final refreshToken = _storage.read(key: _refreshTokenKey);
    final expiresIn = _storage.read(key: _expiresInKey);
    final createdAt = _storage.read(key: _createdAtKey);

    final results = await Future.wait(
      [accessToken, refreshToken, expiresIn, createdAt],
    );

I am using the default iOS keychain options, but it looks like my choices are to change those options to first_unlock or first_unlock_this_device OR downgrade to 9.0.0 (not sure why this would help, but there have been reports of it helping...)?

However I read in another issue that while this may allow background access on iOS, Android doesn't support it? That seems like a dealbreaker. Is this still the case @juliansteenbakker?

from flutter_secure_storage.

nblum37 avatar nblum37 commented on August 11, 2024

Hi,

We observe the same issue (in our case this makes the whole app unusable). Are there any other fixes except rolling back the version? Thank you.

from flutter_secure_storage.

btrautmann avatar btrautmann commented on August 11, 2024

Hi,

We observe the same issue (in our case this makes the whole app unusable). Are there any other fixes except rolling back the version? Thank you.

I ended up migrating from one storage type to another (specifically first_unlock_this_device) to allow background access. Note that you actually need to migrate, you can't just change the iOS keychain access type, otherwise existing users will not be able to retrieve previously saved values.

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.