Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.

Commit 0605faf

Browse files
authored
Update grpc.py
Also updated docstring for similar error with `mtls_endpoint`
1 parent bce70c6 commit 0605faf

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

google/auth/transport/grpc.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class AuthMetadataPlugin(grpc.AuthMetadataPlugin):
5151
account credentials.
5252
"""
5353

54-
def __init__(self, credentials, request, default_host=None):
54+
def __init__(self, request, default_host=None):
5555
# pylint: disable=no-value-for-parameter
5656
# pylint doesn't realize that the super method takes no arguments
5757
# because this class is the same name as the superclass.
@@ -73,7 +73,7 @@ def _get_authorization_headers(self, context):
7373
# Attempt to use self-signed JWTs when a service account is used.
7474
# A default host must be explicitly provided since it cannot always
7575
# be determined from the context.service_url.
76-
if isinstance(self._credentials, service_account.Credentials):
76+
if isinstance(self._ service_account.Credentials):
7777
self._credentials._create_self_signed_jwt(
7878
"https://{}/".format(self._default_host) if self._default_host else None
7979
)
@@ -164,7 +164,7 @@ def my_client_cert_callback():
164164
165165
try:
166166
channel = google.auth.transport.grpc.secure_authorized_channel(
167-
credentials, mtls_endpoint, request,
167+
credentials, request, mtls_endpoint,
168168
client_cert_callback=my_client_cert_callback)
169169
except MyClientCertFailureException:
170170
# handle the exception
@@ -202,14 +202,14 @@ def my_client_cert_callback():
202202
certificate and key::
203203
204204
channel = google.auth.transport.grpc.secure_authorized_channel(
205-
credentials, request, regular_endpoint)
205+
request, regular_endpoint)
206206
207207
The following code uses mtls_endpoint, if the created channle is regular,
208-
and API mtls_endpoint is confgured to require client SSL credentials, API
208+
and API mtls_endpoint is confgured to require client SSL API
209209
calls using this channel will be rejected::
210210
211211
channel = google.auth.transport.grpc.secure_authorized_channel(
212-
credentials, request, mtls_endpoint)
212+
request, mtls_endpoint)
213213
214214
Args:
215215
credentials (google.auth.credentials.Credentials): The credentials to
@@ -243,7 +243,7 @@ def my_client_cert_callback():
243243
creation failed for any reason.
244244
"""
245245
# Create the metadata plugin for inserting the authorization header.
246-
metadata_plugin = AuthMetadataPlugin(credentials, request)
246+
metadata_plugin = AuthMetadataPlugin( request)
247247

248248
# Create a set of grpc.CallCredentials using the metadata plugin.
249249
google_auth_credentials = grpc.metadata_call_credentials(metadata_plugin)
@@ -274,10 +274,10 @@ def my_client_cert_callback():
274274

275275
# Combine the ssl credentials and the authorization credentials.
276276
composite_credentials = grpc.composite_channel_credentials(
277-
ssl_credentials, google_auth_credentials
277+
ssl_ google_auth_credentials
278278
)
279279

280-
return grpc.secure_channel(target, composite_credentials, **kwargs)
280+
return grpc.secure_channel(target, composite_ **kwargs)
281281

282282

283283
class SslCredentials:

0 commit comments

Comments
 (0)