Comments (15)
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.
@vasilich6107 sorry for the delay I've been really busy with other work this week. I will have a fix this weekend 👍
from fresh.
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.
@vasilich6107 thanks so much! I'll have a look asap 😄
from fresh.
Let me describe two scenarios) In next two messages
from fresh.
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 seerefresh 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.
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.
Hi @felangel
Any news?
from fresh.
Any news on this, the static analysis on this package is broken
from fresh.
This should be addressed as part of #39
from fresh.
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.
@felangel any feedback?
from fresh.
@felangel any news?
from fresh.
I think this should be resolved by #68. Will get that merged and published shortly
from fresh.
Ok
Will check after merge
from fresh.
Related Issues (20)
- Possible race condition when using custom tokenStorage HOT 2
- Retry the http request upon refresh HOT 1
- Update example code HOT 1
- refreshToken not called at all? HOT 1
- Replace graphql dependency with gql_link HOT 3
- not enough examples HOT 3
- token returns null when awaited right after initializing HOT 3
- Move to QueuedInterceptor in Dio HOT 1
- Request headers bug HOT 3
- can't figure out how to use package! HOT 1
- Updated package to use dio 5.0.0 HOT 7
- [fresh_graphql] shouldRefresh example needed HOT 5
- [fresh_graphql] wrong auth status HOT 2
- [fresh_graphql] wrong Bearer case HOT 1
- [fresh_grahpql] Multiple request HOT 5
- [fresh_graphql] update http to 1.0.0 HOT 2
- Fresh causes requests to never complete HOT 1
- [fresh_dio] Recommended way to log refresh and retry requests HOT 3
- How to test fresh_dio with a Mock HttpClientAdapter? HOT 1
- [ Concurrent API calls ] HOT 1
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 fresh.