-
-
Notifications
You must be signed in to change notification settings - Fork 628
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
[QUESTION] - How to do a token refresh? #672
Comments
The way I did was: final AuthLink authLink = AuthLink(
getToken: () async {
final token = await getAccessToken();
return `Bearer $token`
},
); And the
|
@brenoasm we don't have an offline operation queue implemented in core (for |
@Gujie-Novade Cool, what happen's If multiple requests are sent with the invalid token? All the requests pass by the getToken? @micimize Sorry for the question, but I'not expert using Apollo. Would not be the case to implement such routine? Dio for example has It built in (I mean the queue and way to lock and unlock the client), os it not usefull while using graphql? I did the queue process in my application after I've posted this question, It works but i'm not sure if It is the right way to do. |
@brenoasm The client doesn't have any awareness of the relatedness of the failures, so unless you set a flag in your code based on an auth error it will continue along as normal. It'd definitely be useful, but is just non-trivial. A more complicated offline queue is desirable for even more reasons in graphql (#201) You could make a custom AuthLink with refresh state/logic that waits to call Idk how useful this is but on the v4 alpha we use |
Thanks for the response! I did the retry logic inside a custom link, like you said. I was not aware about the v4 and If It let me use an Dio as client, for sure all about I said is built in. I'll close this issue. |
Hello, Would you mind sharing your implementation of |
Hi, I've been using It to build an personal project and finding hard to implement a refresh process. Using Dio I can block the client so all the subsequence requests goes to a queue and then after unlock the queue is processed. Using graphql_flutter do I need to implement something like that by myself? If someone has some example to show me. Thanks in advance.
The text was updated successfully, but these errors were encountered: