New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 859684 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jul 12
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android , Mac
Pri: 1
Type: Bug



Sign in to add a comment

Need to invalidate auth token after receiving 401 error code

Project Member Reported by zea@chromium.org, Jul 2

Issue description

Follow up to b/110533555.

It appears that I have a chrome canary client that is always using the same ntp_snippets oauth access token. Even across restarts, the client uses the same access token, which always results in the server returning a 401 due to the token being expired.

From https://developer.android.com/reference/android/accounts/AccountManager it looks like perhaps we need to be forcing the android auth manager to invalidate the access token.

Looking at the sync code, it appears we do just that every time we fetch a new token:
https://cs.chromium.org/chromium/src/components/browser_sync/sync_auth_manager.cc?sq=package:chromium&g=0&l=267

The Zine code likely needs to do the same.

Mihai, does that sound right to you? This makes me wonder how this ever worked in the first place. When does the Chrome identity manager automatically invalidate tokens?
 
Also big kudos to Tommy for pointing out the AccountManager documentation :)
Components: UI>Browser>NewTabPage
Labels: zine-triaged
On non-Android platforms token service caches token expiration time along with the token and uses it to decide when to request new one (https://cs.chromium.org/chromium/src/google_apis/gaia/oauth2_token_service.cc?sq=package:chromium&dr&g=0&l=681). 
I don't think there is any auto-expire built into the Android Account Manager setup. It might be in the Google Play services authenticator (that backs the AccountManager for the "com.google" authority), but from the symptoms shown here, I don't think that's the case. I.e. we'd need to manually invoke invalidateToken(...) or use the getNewToken(...) functionality.

It is common (required?) to OAuth2 to provide an expiration timestamp, but it's not made available from the Android auth APIs.
Hey Patrick, anh update on this bug?
Status: Started (was: Assigned)
Status: Fixed (was: Started)
Fixed for Zine. Per https://crbug.com/609084 we should consider putting invalidation and retry logic into a base class so that this isn't a gotcha for everyone doing a similar thing.
Great, thanks Patrick!

And agreed about using a base class. Is it worth filing a bug about that? It probably affects the feed migration work too, right?
I think https://crbug.com/609084 actually captures the context and remaining work fairly well. I'll clean it up a little and assign it to myself.
It looks like this landed in 69.0.3489.0. There are a number of user reports from 67 and 68. We should keep an eye on this in the feedback reports while we wait for M69 to push to stable.

Sign in to add a comment