Coder Social home page Coder Social logo

Comments (15)

vasilich6107 avatar vasilich6107 commented on May 22, 2024 1

I'm back with reproduction)

Here is a repo https://github.com/artflutter/fresh_repro

First of all let's start a demo server
go to jwt_server folder and run

npm install
npm run example

This will run a jwt server. There is also web interface for internal testing purposes http://localhost:12345/

Then launch flutter project.

There is 2 buttons Login and protected. Login - logs in user. Protected - launches request to token protected resource.
The tokens are managed via cookies but for the demo the actual way of token delivery to the server does not matter.

The initial token expiration is set to 1/6 of minute, 10 seconds.

In main.dart on line 79 you can tweak the refresh delay to simulate different scenarios.

from fresh.

felangel avatar felangel commented on May 22, 2024 1

@vasilich6107 sorry for the delay I've been really busy with other work this week. I will have a fix this weekend 👍

from fresh.

felangel avatar felangel commented on May 22, 2024

Hi @vasilich6107 👋
Thanks for opening an issue and for the positive feedback!

Are you able to share a sample app which reproduces the issue? I'm happy to take a closer look and update the package to account for this since it is definitely a place for improvement 😄

from fresh.

felangel avatar felangel commented on May 22, 2024

@vasilich6107 thanks so much! I'll have a look asap 😄

from fresh.

vasilich6107 avatar vasilich6107 commented on May 22, 2024

Let me describe two scenarios) In next two messages

from fresh.

vasilich6107 avatar vasilich6107 commented on May 22, 2024

First scenario - refresh and request repeat.

How to reproduce:

  • open console to see the logs
  • token refresh delay should be 0
  • press login
  • press protected several times until you see refresh operation message in console

There should be next message following refresh operation with flutter: {"message":"Some protected data"} cause after token refresh we need to resend failed request.
https://tppr.me/yRosQ

from fresh.

vasilich6107 avatar vasilich6107 commented on May 22, 2024

Second scenario - multiple refresh request

How to reproduce

  • make app hot restart to clear previous session if needed
  • open console to see the logs
  • token refresh delay should be 5000 (5 seconds)
  • press login
  • press protected "as fast as you can" to spawn multiple requests
  • there will be a tons of refresh token requests in console

There should be only one refresh token requests. All other should be paused and resended after token successfully refreshed.
https://tppr.me/RBZr3

from fresh.

vasilich6107 avatar vasilich6107 commented on May 22, 2024

Hi @felangel
Any news?

from fresh.

marcos930807 avatar marcos930807 commented on May 22, 2024

Any news on this, the static analysis on this package is broken

from fresh.

felangel avatar felangel commented on May 22, 2024

This should be addressed as part of #39

from fresh.

vasilich6107 avatar vasilich6107 commented on May 22, 2024

Hi @felangel
This issue unfortunately is not fixed

I updated https://github.com/artflutter/fresh_repro to the latest versions of available libraries

It it still spams a lot of refresh requests while awaiting for token refresh

See the attached video

Screen.Recording.2022-05-17.at.18.13.12.mov

from fresh.

vasilich6107 avatar vasilich6107 commented on May 22, 2024

@felangel any feedback?

from fresh.

vasilich6107 avatar vasilich6107 commented on May 22, 2024

@felangel any news?

from fresh.

felangel avatar felangel commented on May 22, 2024

I think this should be resolved by #68. Will get that merged and published shortly

from fresh.

vasilich6107 avatar vasilich6107 commented on May 22, 2024

Ok
Will check after merge

from fresh.

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.