AppAuth-Android icon indicating copy to clipboard operation
AppAuth-Android copied to clipboard

Refreshing tokens when doing multiple API calls

Open FilipMarusca opened this issue 7 years ago • 7 comments

Every time before making an API call, I'm calling performActionWithFreshTokens to make sure I'm having the latest token, but I'm having a problem when making multiple API calls one after another.

Let's take an example when 2 API calls are made one after the other. Before each API call, I'm doing performActionWithFreshTokensand updating the tokens if necessary.

The first API call will start refreshing the token, but when the second one is launched, the first one hasn't finished yet so the second one also tries to refresh the token. In the mean time, the first one finished and updates the token. The second one wants to use an old token to refresh and fails.

Do you have a solution for this case?

FilipMarusca avatar Jan 30 '18 15:01 FilipMarusca

Sounds like a bug we should fix; we don't have well defined behavior for current requests at present.

iainmcgin avatar Feb 19 '18 04:02 iainmcgin

Running into this issue as well. Any update on a fix for this?

CodyDunlap avatar Mar 12 '18 13:03 CodyDunlap

I forked the app and made the modification myself. As far as I know, there is no fix at the moment.

FilipMarusca avatar Mar 12 '18 14:03 FilipMarusca

@FilipMarusca would you mind sharing your fix? would be really helpful for us as well thanks!

moliver-bb avatar Mar 12 '18 21:03 moliver-bb

take a look at the method perfomActionWithFreshTokens, the new token is not saved.

FilipMarusca avatar Mar 13 '18 11:03 FilipMarusca

It seems that this issue was fixed time ago but it is still open. What is the state of this?

BraisGabin avatar Mar 24 '22 12:03 BraisGabin