You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In dio Interceptor and the user touch multiple events in a whole app and the api are triggered multiple times and every request call refresh token at the same time and return 400 issue logout to login page
I also tried Future.wait but it trigerred multiple api are given at same time, it will wait return respone
but here the user touch other event where the current api aldready loading and event call api then two api getting refresh will return issue session expired
So how to hold another api until where current api get refresh token then allow that api get data
`class Interceptor{
static Dio dio({dynamic data}) {
final dio = Dio();
dio.interceptors.add(AuthInterceptor(dio: dio));
return dio;
}
}`
`class AuthInterceptor extends QueuedInterceptor {
final Dio? dio;
BuildContext? context;
AuthInterceptor({this.dio, this.context});
@OverRide
void onRequest(
RequestOptions options, RequestInterceptorHandler handler) async {
final accessToken = await Mystorage.read('access');
final refreshToken = await Mystorage.read('refresh');
Devandhiran637
changed the title
how to hold another api untill where current api getting refresh token flutter
how to hold another api untill where current api getting refresh token
Jun 2, 2023
Request Statement
In dio Interceptor and the user touch multiple events in a whole app and the api are triggered multiple times and every request call refresh token at the same time and return 400 issue logout to login page
I also tried Future.wait but it trigerred multiple api are given at same time, it will wait return respone
but here the user touch other event where the current api aldready loading and event call api then two api getting refresh will return issue session expired
So how to hold another api until where current api get refresh token then allow that api get data
`class Interceptor{
static Dio dio({dynamic data}) {
final dio = Dio();
dio.interceptors.add(AuthInterceptor(dio: dio));
}
}`
`class AuthInterceptor extends QueuedInterceptor {
final Dio? dio;
BuildContext? context;
AuthInterceptor({this.dio, this.context});
@OverRide
void onRequest(
RequestOptions options, RequestInterceptorHandler handler) async {
final accessToken = await Mystorage.read('access');
final refreshToken = await Mystorage.read('refresh');
}
@OverRide
class Repo{
void onError(DioError err, ErrorInterceptorHandler handler) async {
}
}
Future callapi(){
var response = await Interceptor.dio(data: typeId).post(
"${Api.url}/xxxxxx",
data: l,
);
}
}`
Solution Brainstorm
No response
The text was updated successfully, but these errors were encountered: