Skip to content
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

Interceptor to renew token #11

Open
jaumard opened this issue Aug 29, 2018 · 1 comment
Open

Interceptor to renew token #11

jaumard opened this issue Aug 29, 2018 · 1 comment

Comments

@jaumard
Copy link
Contributor

jaumard commented Aug 29, 2018

Here is what I have put in place with java retrofit library and I wanted to know if it's possible (or will be) to do it with this one also.

So I had an Interceptor who was executing the request, once I was getting a 401 I was doing stuff to renew the token and retry the request with the new token.
It's very cool way to deal with token renewal easily :) I would like to put that in place again in dart but I don't see how it can be possible.

@jaumard
Copy link
Contributor Author

jaumard commented Aug 30, 2018

Here is where the magic append in retrofit https://github.com/square/okhttp/blob/5b37cda9e00626f43acf354df145fd452c3031f1/okhttp/src/main/java/okhttp3/internal/http/RealInterceptorChain.java#L124

Basically there no intercept before/after, just one method intercept with a Chain object and this object can proceed the request to get a response. The request is processed once by the last interceptors (by recursivity) and then pass back to all interceptors in order.

Would you be interested to make such changes @Jaguar-dart/authors ? For renew the token inside the interceptors that's the only way I see.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant