-
Notifications
You must be signed in to change notification settings - Fork 277
New issue
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
How to catch errors with flutter grpc Interceptor #745
Comments
this is also my issue too , but I couldn't resolve it as well , what I wanted to achieve is to call refresh token and then re-invoke the method which cause the error 16 which I my case server gives the "token is expired .. !" error message , here is my code and I would really appreciate it ANY help : class GrpcTokenInterceptor extends ClientInterceptor {
} |
ok i have found a work around which works great , all I did was to create a global wrapper function which wrap all your requests to server in data source layer , in my case I wanted to catch error and don't let it throw in case its a token expiration error and well to call _refreshAccessToken() function and re-invoke the last method , here is the code : 1-Global wrapper function
2- use it where you want to call an api
|
I am trying to handle the token error when it has expired and perform refreshToken. But my provider that receives network responses from the grpc client receives the response before the token is refreshed. I can see in devtools that the token has been refreshed and the request has been sent
The text was updated successfully, but these errors were encountered: