summaryrefslogtreecommitdiffstats
path: root/google_apis/gaia/oauth2_access_token_fetcher.cc
diff options
context:
space:
mode:
authoryoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-22 09:57:41 +0000
committeryoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-22 09:57:41 +0000
commit4652505e3b3590b9b788fd6507c9723bbf139696 (patch)
treedbe6c56d886306f8aa117d01321114235812bfaa /google_apis/gaia/oauth2_access_token_fetcher.cc
parent703a5c07bb30a042bda733cbd17ad56d0673056c (diff)
downloadchromium_src-4652505e3b3590b9b788fd6507c9723bbf139696.zip
chromium_src-4652505e3b3590b9b788fd6507c9723bbf139696.tar.gz
chromium_src-4652505e3b3590b9b788fd6507c9723bbf139696.tar.bz2
Files.app: Treats HTTP_FORBIDDEN (403) as temporary error on authentication.
Sometimes the auth server returns '403 Rate Limit Exceeded' but it is treated as a permanent error and makes Files.app offline-mode. This patch makes '403' treated as a temporary error. BUG=180830 TEST=Repeat logging-in and opening Files.app 20 times, and confirms the error is not happen. Review URL: https://codereview.chromium.org/12630010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189787 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'google_apis/gaia/oauth2_access_token_fetcher.cc')
-rw-r--r--google_apis/gaia/oauth2_access_token_fetcher.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/google_apis/gaia/oauth2_access_token_fetcher.cc b/google_apis/gaia/oauth2_access_token_fetcher.cc
index edefa7e..731dab8 100644
--- a/google_apis/gaia/oauth2_access_token_fetcher.cc
+++ b/google_apis/gaia/oauth2_access_token_fetcher.cc
@@ -129,6 +129,15 @@ void OAuth2AccessTokenFetcher::EndGetAccessToken(
return;
}
+ // HTTP_FORBIDDEN (403) is treated as temporary error, because it may be
+ // '403 Rate Limit Exeeded.'
+ if (source->GetResponseCode() == net::HTTP_FORBIDDEN) {
+ OnGetTokenFailure(GoogleServiceAuthError(
+ GoogleServiceAuthError::SERVICE_UNAVAILABLE));
+ return;
+ }
+
+ // The other errors are treated as permanent error.
if (source->GetResponseCode() != net::HTTP_OK) {
OnGetTokenFailure(GoogleServiceAuthError(
GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS));