Skip to content

Commit e9d73ac

Browse files
authored
fix: revert "feat: send quota project id in x-goog-user-project header for OAuth2 credentials (#400)" (#407)
This reverts commit ab3dc1e26f5240ea3456de364c7c5cb8f40f9583.
1 parent 0ad9d86 commit e9d73ac

File tree

4 files changed

+0
-60
lines changed

4 files changed

+0
-60
lines changed

packages/google-auth/docs/reference/google.auth.crypt.base.rst

Lines changed: 0 additions & 7 deletions
This file was deleted.

packages/google-auth/docs/reference/google.auth.crypt.rsa.rst

Lines changed: 0 additions & 7 deletions
This file was deleted.

packages/google-auth/google/oauth2/credentials.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ def __init__(
5858
client_id=None,
5959
client_secret=None,
6060
scopes=None,
61-
quota_project_id=None,
6261
):
6362
"""
6463
Args:
@@ -82,9 +81,6 @@ def __init__(
8281
token if refresh information is provided (e.g. The refresh
8382
token scopes are a superset of this or contain a wild card
8483
scope like 'https://www.googleapis.com/auth/any-api').
85-
quota_project_id (Optional[str]): The project ID used for quota and billing.
86-
This project may be different from the project used to
87-
create the credentials.
8884
"""
8985
super(Credentials, self).__init__()
9086
self.token = token
@@ -94,7 +90,6 @@ def __init__(
9490
self._token_uri = token_uri
9591
self._client_id = client_id
9692
self._client_secret = client_secret
97-
self._quota_project_id = quota_project_id
9893

9994
@property
10095
def refresh_token(self):
@@ -128,11 +123,6 @@ def client_secret(self):
128123
"""Optional[str]: The OAuth 2.0 client secret."""
129124
return self._client_secret
130125

131-
@property
132-
def quota_project_id(self):
133-
"""Optional[str]: The project to use for quota and billing purposes."""
134-
return self._quota_project_id
135-
136126
@property
137127
def requires_scopes(self):
138128
"""False: OAuth 2.0 credentials have their scopes set when
@@ -179,12 +169,6 @@ def refresh(self, request):
179169
)
180170
)
181171

182-
@_helpers.copy_docstring(credentials.Credentials)
183-
def apply(self, headers, token=None):
184-
super(Credentials, self).apply(headers, token=token)
185-
if self.quota_project_id is not None:
186-
headers["x-goog-user-project"] = self.quota_project_id
187-
188172
@classmethod
189173
def from_authorized_user_info(cls, info, scopes=None):
190174
"""Creates a Credentials instance from parsed authorized user info.
@@ -218,9 +202,6 @@ def from_authorized_user_info(cls, info, scopes=None):
218202
scopes=scopes,
219203
client_id=info["client_id"],
220204
client_secret=info["client_secret"],
221-
quota_project_id=info.get(
222-
"quota_project_id"
223-
), # quota project may not exist
224205
)
225206

226207
@classmethod

packages/google-auth/tests/oauth2/test_credentials.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -294,33 +294,6 @@ def test_credentials_with_scopes_refresh_failure_raises_refresh_error(
294294
# expired.)
295295
assert creds.valid
296296

297-
def test_apply_with_quota_project_id(self):
298-
creds = credentials.Credentials(
299-
token="token",
300-
refresh_token=self.REFRESH_TOKEN,
301-
token_uri=self.TOKEN_URI,
302-
client_id=self.CLIENT_ID,
303-
client_secret=self.CLIENT_SECRET,
304-
quota_project_id="quota-project-123",
305-
)
306-
307-
headers = {}
308-
creds.apply(headers)
309-
assert headers["x-goog-user-project"] == "quota-project-123"
310-
311-
def test_apply_with_no_quota_project_id(self):
312-
creds = credentials.Credentials(
313-
token="token",
314-
refresh_token=self.REFRESH_TOKEN,
315-
token_uri=self.TOKEN_URI,
316-
client_id=self.CLIENT_ID,
317-
client_secret=self.CLIENT_SECRET,
318-
)
319-
320-
headers = {}
321-
creds.apply(headers)
322-
assert "x-goog-user-project" not in headers
323-
324297
def test_from_authorized_user_info(self):
325298
info = AUTH_USER_INFO.copy()
326299

0 commit comments

Comments
 (0)