hey guys, is there some mechanism that allows to m...
# ktor
g
hey guys, is there some mechanism that allows to make refresh token request if I got a special error and repeat the initial request after that ?
r
Yes. Ktor Auth
Use a custom provider
You have 2 options I think
if it’s a JWT token or similar, you can read it and see if it’s still valid. If it’s not, refresh it in your implementation of
addRequestHeaders
before adding it
The other option is to have 2 providers, one which always adds the auth headers to requests, and the other which only exists to handle 401
g
thx, I’ll take a look