diff options
author | pavely@chromium.org <pavely@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-16 20:47:07 +0000 |
---|---|---|
committer | pavely@chromium.org <pavely@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-16 20:48:41 +0000 |
commit | 83d10dd522315ce95d327efa0b2a91fd3ec3aed3 (patch) | |
tree | b8792536e41c67e062aefde7a2caef66c5fca22f /google_apis | |
parent | e7bce4832f5ea88abf3102fa366f7bc54b744af0 (diff) | |
download | chromium_src-83d10dd522315ce95d327efa0b2a91fd3ec3aed3.zip chromium_src-83d10dd522315ce95d327efa0b2a91fd3ec3aed3.tar.gz chromium_src-83d10dd522315ce95d327efa0b2a91fd3ec3aed3.tar.bz2 |
Prevent invalidating refresh token on transient errors.
Problem:
When access token request fails with unexpected errors those get
translated to "invalid credentials". In response auth_sync_observer.cc
marks refresh token as invalid which prevents offline auth on next startup.
oauth2_access_token_fetcher_impl.cc:
- Handle all 5xx http codes as transient errors.
- Log error for unexpected codes.
profile_sync_service.cc:
- handle REQUEST_CANCELLED and SERVICE_ERROR as transient error, retry instead of
notifying observers.
- Log error for unexpected auth errors.
BUG=394939
R=rogerta@chromium.org,zea@chromium.org
Review URL: https://codereview.chromium.org/472403002
Cr-Commit-Position: refs/heads/master@{#290158}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290158 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'google_apis')
-rw-r--r-- | google_apis/gaia/oauth2_access_token_fetcher_impl.cc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/google_apis/gaia/oauth2_access_token_fetcher_impl.cc b/google_apis/gaia/oauth2_access_token_fetcher_impl.cc index f4cd4f0..08e45d2 100644 --- a/google_apis/gaia/oauth2_access_token_fetcher_impl.cc +++ b/google_apis/gaia/oauth2_access_token_fetcher_impl.cc @@ -183,9 +183,8 @@ void OAuth2AccessTokenFetcherImpl::EndGetAccessToken( case net::HTTP_OK: break; case net::HTTP_FORBIDDEN: - case net::HTTP_INTERNAL_SERVER_ERROR: // HTTP_FORBIDDEN (403) is treated as temporary error, because it may be - // '403 Rate Limit Exeeded.' 500 is always treated as transient. + // '403 Rate Limit Exeeded.' OnGetTokenFailure( GoogleServiceAuthError(GoogleServiceAuthError::SERVICE_UNAVAILABLE)); return; @@ -212,11 +211,20 @@ void OAuth2AccessTokenFetcherImpl::EndGetAccessToken( : GoogleServiceAuthError(GoogleServiceAuthError::SERVICE_ERROR)); return; } - default: - // The other errors are treated as permanent error. - OnGetTokenFailure(GoogleServiceAuthError( - GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS)); + default: { + if (source->GetResponseCode() >= net::HTTP_INTERNAL_SERVER_ERROR) { + // 5xx is always treated as transient. + OnGetTokenFailure(GoogleServiceAuthError( + GoogleServiceAuthError::SERVICE_UNAVAILABLE)); + } else { + // The other errors are treated as permanent error. + DLOG(ERROR) << "Unexpected persistent error: http_status=" + << source->GetResponseCode(); + OnGetTokenFailure(GoogleServiceAuthError( + GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS)); + } return; + } } // The request was successfully fetched and it returned OK. |