We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
AlexV525
kuhnroyal
Learn more about funding links in repositories.
Report abuse
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dio
4.0.6
Android, iOS
flutter doctor -v
[√] Flutter (Channel stable, 3.13.4, on Microsoft Windows [version 10.0.19045.3570], locale fr-FR) • Flutter version 3.13.4 on channel stable at C:\src\flutter\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 367f9ea16b (5 weeks ago), 2023-09-12 23:27:53 -0500 • Engine revision 9064459a8b • Dart version 3.1.2 • DevTools version 2.25.0
3.1.2
make a WS call on BG/FG :
@override void didChangeAppLifecycleState(AppLifecycleState state) { switch (state) { case AppLifecycleState.resumed: initNewVersionPlusDialog(); if (_isLogged && _appModel.currentUser!.accessToken != null) { // HERE MAKE THE WS CALL } break; default: // nothing } }
and with interceptor like :
class TokenInterceptor extends Interceptor { AppModel appModel = _mainContext.read(); @override Future<void> onRequest(RequestOptions options, RequestInterceptorHandler handler) async { final user = appModel.currentUser; if (user != null) { final token = user.accessToken; options.headers["Authorization"] = token; } else { print(">> Authorization token NULL ! <<"); } super.onRequest(options, handler); }
a WS call with the proper header (and that's the case 90% of time)
When doing a WS call on BG/FG it sometimes does not add the token in appropriate header...
What's wierd is that i can't reproduce on emulators nor on my personnal device !
But we DO have stacktraces from our server that returns error 500 no header from springboot Backends...
Even wierder : i did add the following test : if (_isLogged && _appModel.currentUser!.accessToken != null) {
if (_isLogged && _appModel.currentUser!.accessToken != null) {
and it's done anyway missing the header :/
What am i missing ?
Is there a way to cancel such an intercepted request ? how ? And i also do want the login very first request to pass without this header ...
Thanks in advance.
The text was updated successfully, but these errors were encountered:
_mainContext.read().currentUser
onRequest
Closing as invalid.
Sorry, something went wrong.
No branches or pull requests
Package
dio
Version
4.0.6
Operating-System
Android, iOS
Output of
flutter doctor -v
Dart Version
3.1.2
Steps to Reproduce
make a WS call on BG/FG :
and with interceptor like :
Expected Result
a WS call with the proper header (and that's the case 90% of time)
Actual Result
When doing a WS call on BG/FG it sometimes does not add the token in appropriate header...
What's wierd is that i can't reproduce on emulators nor on my personnal device !
But we DO have stacktraces from our server that returns error 500 no header from springboot Backends...
Even wierder : i did add the following test :
if (_isLogged && _appModel.currentUser!.accessToken != null) {
and it's done anyway missing the header :/
What am i missing ?
Is there a way to cancel such an intercepted request ?
how ?
And i also do want the login very first request to pass without this header ...
Thanks in advance.
The text was updated successfully, but these errors were encountered: