Google Drive Connector v2: OAuth 2.0 JWT Bearer fails with JWT Subject / Domain-Wide Delegation

Hi,

I’m debugging a Google Drive Connector v2 connection using
OAuth 2.0 - JWT Bearer and Google Workspace Domain-Wide Delegation.

Environment:

  • Google Drive Connector v2
  • Region: europe-west3
  • Authentication: OAuth 2.0 - JWT Bearer
  • Service account: (PII Removed by Staff)
  • JWT Subject: my@do.main
  • DWD scope: https://www.googleapis.com/auth/drive

The important part is the following A/B test.

  1. Same connector
  2. Same service account
  3. Same JSON key
  4. Same Secret Manager secret
  5. Same Drive connector version

WITHOUT JWT Subject:
Connection = ACTIVE

WITH:
JWT Subject = my@do.main

the connection fails with:

OAUTH [30004] Failed to retrieve OAuth token information.
unauthorized_client:
Client is unauthorized to retrieve access tokens using this method,
or client not authorized for any of the scopes requested.

I independently tested the exact same service account and subject
outside of Integration Connectors using Google’s Python auth library:

scopes = ["https://www.googleapis.com/auth/drive"]
subject = "my@do.main"

The token request succeeds and returns an access token.

The Connector DEBUG log shows:

authscheme=OAuthJWT
oauthjwtcerttype=GOOGLEJSONBLOB
oauthjwtsubject=my@do.main
scope=''

and then the connector sends a JWT bearer request to:

https://www.googleapis.com/oauth2/v3/token

which returns 401 unauthorized_client.

So the key/DWD/service account itself appears to work, while
impersonation through the Drive Connector does not.

Questions:

  1. Is JWT Subject / Domain-Wide Delegation supported for the
    Google Drive Connector v2?
  2. Does the connector generate the required OAuth JWT scope claim
    when JWT Subject is configured?
  3. Is there a supported way to specify the JWT scope for this
    authentication mode?
  4. Could this be a bug in the Google Drive Connector v2 / underlying
    provider implementation?

I can provide sanitized DEBUG logs and the exact connection
configuration if needed.

Hi @Wolfgang_Martin, thank you for sharing such a detailed step-by-step breakdown.

We have seen your question and we encourage community members to weigh in with their experience or findings.

In the meantime, you can review the official Application Integration Documentation for additional diagnostic insights.

The connector is sending an empty scope claim in the impersonated token request.

DEBUG log: scope=''.

In the OAuth 2.0 JWT-bearer (server-to-server) flow, when the assertion carries a sub claim (i.e. domain-wide delegation / impersonation), the JWT must also carry a non-empty scope claim, and that scope must be authorized for the service account’s numeric Client ID in the Workspace Admin console (Security → API Controls → Domain-wide delegation). An impersonated token request with no/empty scope is rejected by Google’s token endpoint with exactly this error: unauthorized_client — “Client is unauthorized to retrieve access tokens using this method, or client not authorized for any of the scopes requested” (see the server-to-server OAuth error table at developers.google.com/identity/protocols/oauth2/service-account#error-codes).

This explains the A/B test:
• Without JWT Subject → no impersonation, so the empty-scope path isn’t exercised → connection ACTIVE.
• With JWT Subject → the connector does the DWD token exchange but sends scope='' → Google rejects it.
• Your standalone Python test works because it explicitly sets scopes=[“https://www.googleapis.com/auth/drive”]. That proves the SA, key, subject, and the Admin-console DWD grant are all correct — the gap is on the connector side (scope not injected into the JWT).

Answers to the questions:

  1. JWT Subject / DWD is the intended mechanism for impersonation on this auth type → supported.
  2. Does the connector generate the scope claim when JWT Subject is set? Per the scope='' log, in this config it does not.
  3. Supported way to specify the JWT scope? Check the connection’s auth config for a scope / additional-fields setting and ensure the Drive scope is populated. If no field maps to the OAuth JWT scope, that’s the missing piece.
  4. Possible connector bug? Plausible if there’s no way to supply the scope for the JWT-bearer + Subject combination — worth confirming and filing.

Also worth a quick double-check on the Admin-console side (the other documented cause of this exact error variant), though the Python test suggests it’s already fine: DWD must be authorized with the SA’s numeric Client ID (not the SA email) and not via a Google Group.

Can you provide:

  • region + exact connector version
  • the auth section of the connection config (incl. any scope/additional fields)
  • the full DEBUG snippet around the token request (authscheme/oauthjwt*/scope lines + token endpoint request/response)
  • how DWD was authorized (numeric Client ID vs email, individual vs Google Group).

The connector is in region europe-west3, version is V2.

I queried the connector’s auth schema using fetchAuthSchema for Google Drive Connector v2. For OAUTH2_JWT_BEARER, the connector exposes only:

oauth2_jwt_bearer.client_key

additional_variables.oauthjwt_subject

There is no scope/scopes auth field.

When oauthjwt_subject is set, the DEBUG log shows scope='' and Google’s token endpoint returns unauthorized_client.

When oauthjwt_subject is omitted, the exact same service account/key produces an ACTIVE connection.

What is the supported way to provide the OAuth scope for JWT Bearer + Domain-Wide Delegation?

The DWD:

The connector auth:

Here the logs:

Title:
Google Drive Connector v2: JWT Bearer + JWT Subject fails with unauthorized_client

Environment

Connector: Google Drive v2
Region: europe-west3
Auth: OAuth 2.0 JWT Bearer
Service account:
JWT Subject: (PII Removed by Staff)

Problem

The same service account, JSON key and connector version produce
different results depending only on whether JWT Subject is configured.

A/B test:

  1. JWT Subject NOT configured
    → Connection becomes ACTIVE

  2. JWT Subject = (PII Removed by Staff)
    → Connection fails with:

    OAUTH [30004] Failed to retrieve OAuth token information.
    unauthorized_client

DEBUG log:

[INFO|Connec] Connection String:
authscheme=OAuthJWT;
oauthjwtcert=*****;
oauthjwtcerttype=GOOGLEJSONBLOB;
oauthjwtissuer=‘’;
oauthjwtsubject=(PII Removed by Staff);
scope=‘’;
supportsalldrives=true;
verbosity=5

The connector then sends:

POST https://www.googleapis.com/oauth2/v3/token

with:

assertion=*****
&grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer

Google responds:

HTTP/1.1 401 Unauthorized

{
“error”: “unauthorized_client”,
“error_description”:
“Client is unauthorized to retrieve access tokens using this method, or client not authorized for any of the scopes requested.”
}

Independent test

The same service account and subject work outside the connector.

Using a Python service-account JWT with:

sub = wolfgang@martin.eu
scope = https:// www. googleapis. com/auth/drive <blanks added, I am not allowed to post more than to links>

the access token is successfully retrieved.

Domain-Wide Delegation is configured for the service account’s numeric
Client ID with the Drive scope.

Connector auth schema

I also queried fetchAuthSchema for Google Drive Connector v2.

For OAUTH2_JWT_BEARER it exposes only:

oauth2_jwt_bearer.client_key
additional_variables.oauthjwt_subject

There is no scope or scopes auth field.

Question

When JWT Subject is configured for Domain-Wide Delegation, how is the
OAuth scope supposed to be supplied to the JWT-bearer token request?

The connector DEBUG output contains:

oauthjwtsubject=(PII Removed by Staff)
scope=‘’

Is this a connector bug or is there another supported way to configure
the OAuth scope for JWT Bearer + Domain-Wide Delegation?

Update to my previous post:

I have configured another connector into Goggle calendar.

I am using the same service account, same secret etc.

I am setting JWT subject again to (PII Removed by Staff).

The connector starts without any issues, it can be activated and deactivated from an automation and it accesses the correct calendar.

The logs again show scope = ’ ’

Might there be a bug in the drive connector?

Thanks man, it helps me