Log in as both users and return the pair, valid until the sooner expiry.
Retried once as a unit, because the two logins are not independent: the
bank-user login authenticates with the api-user token minted a line above
it, and a login by ANY other holder of this credential in that window
revokes it. That is not hypothetical — it is WIRE-EMAIL-HANDLER-A, an
InvalidToken on getBankUserToken against a token microseconds old.
Re-minting the api token is the whole remedy, so the retry restarts from
getApiUserToken. One extra attempt only: a credential losing this race
twice running is contention no amount of local retrying resolves, and each
further attempt revokes someone else's token on the way past.
Log in as both users and return the pair, valid until the sooner expiry.
Retried once as a unit, because the two logins are not independent: the bank-user login authenticates with the api-user token minted a line above it, and a login by ANY other holder of this credential in that window revokes it. That is not hypothetical — it is
WIRE-EMAIL-HANDLER-A, anInvalidTokenongetBankUserTokenagainst a token microseconds old.Re-minting the api token is the whole remedy, so the retry restarts from
getApiUserToken. One extra attempt only: a credential losing this race twice running is contention no amount of local retrying resolves, and each further attempt revokes someone else's token on the way past.