Drive API returns 401 invalid_token while UserInfo accepts the same freshly issued access token

Hello,

We operate a PHP web application called “Familienuniversum” using Google OAuth authorization-code flow and offline access.

Three Google account works correctly. Another account intermittently fails. The affected account explicitly shows that our application has permission to access Google Calendar, app-related Google Drive files, and basic account information.

OAuth application configuration:

  • Audience: External

  • Publishing status: In production

  • Requested scopes: openid, userinfo.email, calendar.events.owned, drive.file

  • Backend: PHP with native cURL

Latest controlled comparison:
Date: 2026-10-08, 20:58:09 UTC

Working account:

  1. Refresh-token exchange: HTTP 200

  2. UserInfo request: HTTP 200

  3. Drive files.get: HTTP 200

  4. Drive files.list: HTTP 200

Affected account:

  1. Refresh-token exchange: HTTP 200

  2. Response contains an access token, token_type=Bearer and positive expires_in.

  3. UserInfo request: HTTP 200

  4. Drive files.get: HTTP 401

    • WWW-Authenticate error: invalid_token

    • JSON error reason: authError

The same freshly issued access token was used for UserInfo and Drive. Our diagnostic checked cURL’s outgoing Authorization header and confirmed that the sent token exactly matched the token returned by the token endpoint. No tokens or token hashes are included in the diagnostic output.

The behavior is intermittent: earlier comparisons sometimes succeeded for this account. Other attempts failed at UserInfo or Drive files.list with HTTP 401. Some new authorization attempts also failed at the subsequent UserInfo request.

We have not established whether account supervision through Family Link is involved.

Could you advise:

  1. What can cause Drive to reject a freshly issued token that UserInfo accepts?

  2. Could supervised-account policies produce this behavior despite visible consent?

  3. Which additional non-sensitive response headers or diagnostic information would help investigate?

  4. Is there a private support channel for supplying the project ID and affected account details?

We can provide sanitized diagnostic JSON. We have not established whether the cause is in our application, account policy, or the API.

Thank you. BR Peter

Hi Peter,

This intermittent behavior where a freshly minted token passes UserInfo but immediately fails on Google Drive endpoints (HTTP 401 invalid_token) usually points to scope mismatches, propagation delays, or backend account policies during token issuance.

1. Why Drive Rejects Tokens That UserInfo Accepts

  • Scope Truncation / Partial Consent: UserInfo only requires basic openid or profile scopes. If Google’s authorization server issues a downscoped token that drops drive.file due to a transient consent or policy flag, the token remains perfectly valid for UserInfo but fails instantly on Drive.

  • Backend Authorization Token Sync: UserInfo endpoints run on standard OAuth identity infrastructure, whereas Google Drive API validates access through Google’s internal API gateways (ESF). If the newly issued access token metadata has not fully replicated across Google’s global API gateway nodes, Drive will return a transient 401 while UserInfo succeeds.

  • Token Lifetime vs. Revocation Flags: If the user’s session is subject to strict session length rules or conditional access checks, Google may issue a token that gets marked as restricted or revoked by secondary security filters before it hits the Drive service.

2. Impact of Supervised Accounts (Family Link)

Yes, Family Link and managed parental controls cause this exact symptom.

Family Link applies real-time policy checks when a child account attempts to access third-party apps. Parents can grant permission during the initial consent screen, but Google’s backend dynamically blocks or restricts third-party API calls to sensitive services like Drive on a per-request basis. Because UserInfo is deemed basic identity, it passes, but data-access endpoints like Drive get blocked downstream, surfacing as an invalid_token or authError.

3. Key Non-Sensitive Diagnostics to Inspect

To isolate where the chain breaks, log these non-sensitive response items:

  • Inspect the Token Scope Response: Log the exact scope string returned in the JSON body of your HTTP 200 refresh-token response. Verify whether [https://www.googleapis.com/auth/drive.file](https://www.googleapis.com/auth/drive.file) is actually present in the granted scope list for that specific refresh attempt.

  • Token Info Debug Endpoint: Make a GET request to [``https://oauth2.googleapis.com/tokeninfo?access_token=YOUR_TOKEN``](``https://oauth2.googleapis.com/tokeninfo?access_token=YOUR_TOKEN``). Check the returned scope array and expires_in fields right when the 401 occurs.

  • Response Headers on 401: Log the X-Request-Id, Date, and Server headers from the failing Drive response. The X-Request-Id allows Google engineers to trace the exact gateway request log.

Verification: If tokeninfo shows the drive.file scope is missing on failing attempts, the issue is partial scope granting or account-level policy stripped by Google during token minting.

4. Reaching Private Google Support

Since this is an OAuth integration issue with potential account-specific policy blocks, public forums cannot process private project IDs or user emails.

  • Google Cloud Console Support: Navigate to Google Cloud Console > Support > Cases for your Familienuniversum project to submit project IDs and anonymized account logs directly to GCP OAuth engineers.

  • OAuth App Verification Desk: If your app is undergoing or has completed verification, reply directly to your existing verification ticket thread with the OAuth Trust & Safety team.