I am stuck on a problem and the situation is that I am calling Observable getFilms() and when the token has expired and it throws an onError I would like to ask another Observable for refresh token 'wait' and have this getFilms() method resubscribe.
I tried retryWhen but it is called 3 times which is not what I want and it doesn't give the desired effect even with setting the firstAttempt condition
getFilms() .hereWaitForRefreshTokenObservable() .~ .subscribe(films ->)
If anyone gets here the solution to this is to use Authenticator correctly.
In my case I doubted its performance and spent a couple of hours trying to fix it in the RXJava layer.
I simply forgot to add the "Bearer" :
.header("Authorization", "Bearer $newToken")