Hi there, I am trying to get Ktor client to trigger a token refresh when getting a 401. Unfortunately the api is not setting the correct auth scheme in the response header. They are using “default” when the BearerAuthProvider expects “bearer” obviously. This prevents the token refresh logic from being run. Any ideas on a not so hacky way around this?
The current solution is to have your own Auth feature. I actually never used the provided Auth feature as it always had multiple problems. This one remains…
I think that their point is that if you want to handle all 401 as the sole info needed to trigger token refresh, then you should modify the server response inside the client pipeline before the Auth feature gets triggered to make it look like whatever response their (standard) implementation of auth is expecting.
I would prefer some kind of
function we could override somewhere in the feature, but oh well
08/19/2021, 8:42 AM
Thanks for the info 🙂 Any ideas on how to modify the response before it gets to the auth feature?
I would prefer not to copy and paste the whole auth feature, kinda defeats the purpose of using ktor client for me…