buffet: Forcibly refresh access token when handling HTTP error 401.

It's not enough to just check that the access token hasn't expired so
always fetch a new access token when the server specifically tells us
that the access token is wrong (e.g. HTTP error code 401).

BUG=brillo:275
TEST=Unit tests pass.

Change-Id: Ib619883a9629e313c9f76679232bcd245bf83bb9
Reviewed-on: https://chromium-review.googlesource.com/255590
Reviewed-by: Nathan Bullock <nathanbullock@google.com>
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
(cherry picked from commit 155a413327fdc20a99e195f2753d98cb19cb9db4)
Reviewed-on: https://chromium-review.googlesource.com/258860
Reviewed-by: Patrick Sosinski <sosinski@chromium.org>
Commit-Queue: Patrick Sosinski <sosinski@chromium.org>
Tested-by: Patrick Sosinski <sosinski@chromium.org>
Reviewed-by: Aaron Kemp <kemp@google.com>
2 files changed