diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml
index 0954585f..e2b39f94 100644
--- a/.github/.OwlBot.lock.yaml
+++ b/.github/.OwlBot.lock.yaml
@@ -1,3 +1,3 @@
docker:
image: gcr.io/repo-automation-bots/owlbot-python:latest
- digest: sha256:df50e8d462f86d6bcb42f27ecad55bb12c404f1c65de9c6fe4c4d25120080bd6
+ digest: sha256:99d90d097e4a4710cc8658ee0b5b963f4426d0e424819787c3ac1405c9a26719
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 303d2629..c1103876 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,13 @@
# Changelog
+### [0.4.1](https://www.github.com/googleapis/python-analytics-admin/compare/v0.4.0...v0.4.1) (2021-06-30)
+
+
+### Bug Fixes
+
+* disable always_use_jwt_access ([5e3df32](https://www.github.com/googleapis/python-analytics-admin/commit/5e3df324aa9d428d63d80816d10ad7d2d7ef41c1))
+* disable always_use_jwt_access ([#95](https://www.github.com/googleapis/python-analytics-admin/issues/95)) ([5e3df32](https://www.github.com/googleapis/python-analytics-admin/commit/5e3df324aa9d428d63d80816d10ad7d2d7ef41c1))
+
## [0.4.0](https://www.github.com/googleapis/python-analytics-admin/compare/v0.3.2...v0.4.0) (2021-06-23)
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
index 8c22ca30..9e90e38a 100644
--- a/CONTRIBUTING.rst
+++ b/CONTRIBUTING.rst
@@ -68,14 +68,12 @@ Using ``nox``
We use `nox `__ to instrument our tests.
- To test your changes, run unit tests with ``nox``::
+ $ nox -s unit
- $ nox -s unit-3.8
- $ ...
+- To run a single unit test::
-- Args to pytest can be passed through the nox command separated by a `--`. For
- example, to run a single test::
+ $ nox -s unit-3.9 -- -k
- $ nox -s unit-3.8 -- -k
.. note::
@@ -142,7 +140,7 @@ Running System Tests
- To run system tests, you can execute::
# Run all system tests
- $ nox -s system-3.8
+ $ nox -s system
# Run a single system test
$ nox -s system-3.8 -- -k
@@ -215,8 +213,8 @@ Supported versions can be found in our ``noxfile.py`` `config`_.
.. _config: https://github.com/googleapis/python-analytics-admin/blob/master/noxfile.py
-We also explicitly decided to support Python 3 beginning with version
-3.6. Reasons for this include:
+We also explicitly decided to support Python 3 beginning with version 3.6.
+Reasons for this include:
- Encouraging use of newest versions of Python 3
- Taking the lead of `prominent`_ open-source `projects`_
diff --git a/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/base.py b/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/base.py
index 7538d3c0..a1996ee9 100644
--- a/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/base.py
+++ b/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/base.py
@@ -103,7 +103,7 @@ def __init__(
scopes_kwargs = self._get_scopes_kwargs(self._host, scopes)
# Save the scopes.
- self._scopes = scopes or self.AUTH_SCOPES
+ self._scopes = scopes
# If no credentials are provided, then determine the appropriate
# defaults.
diff --git a/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc.py b/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc.py
index 6f1b6a91..f9cb77ec 100644
--- a/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc.py
+++ b/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc.py
@@ -59,6 +59,7 @@ def __init__(
client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None,
quota_project_id: Optional[str] = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
+ always_use_jwt_access: Optional[bool] = False,
) -> None:
"""Instantiate the transport.
@@ -99,6 +100,8 @@ def __init__(
API requests. If ``None``, then default info will be used.
Generally, you only need to set this if you're developing
your own client library.
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
+ be used for service account credentials.
Raises:
google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport
@@ -151,7 +154,7 @@ def __init__(
scopes=scopes,
quota_project_id=quota_project_id,
client_info=client_info,
- always_use_jwt_access=True,
+ always_use_jwt_access=always_use_jwt_access,
)
if not self._grpc_channel:
diff --git a/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc_asyncio.py b/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc_asyncio.py
index 8e3bbf82..cd7d004c 100644
--- a/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc_asyncio.py
+++ b/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc_asyncio.py
@@ -105,6 +105,7 @@ def __init__(
client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None,
quota_project_id=None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
+ always_use_jwt_access: Optional[bool] = False,
) -> None:
"""Instantiate the transport.
@@ -146,6 +147,8 @@ def __init__(
API requests. If ``None``, then default info will be used.
Generally, you only need to set this if you're developing
your own client library.
+ always_use_jwt_access (Optional[bool]): Whether self signed JWT should
+ be used for service account credentials.
Raises:
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
@@ -197,7 +200,7 @@ def __init__(
scopes=scopes,
quota_project_id=quota_project_id,
client_info=client_info,
- always_use_jwt_access=True,
+ always_use_jwt_access=always_use_jwt_access,
)
if not self._grpc_channel:
diff --git a/samples/requirements.txt b/samples/requirements.txt
index e408ea07..4a38b9a9 100644
--- a/samples/requirements.txt
+++ b/samples/requirements.txt
@@ -1,2 +1,2 @@
-google-analytics-admin==0.3.2
+google-analytics-admin==0.4.0
google-auth-oauthlib==0.4.4
\ No newline at end of file
diff --git a/setup.py b/setup.py
index 1cd3b327..195c6d81 100644
--- a/setup.py
+++ b/setup.py
@@ -19,7 +19,7 @@
import os
import setuptools # type: ignore
-version = "0.4.0"
+version = "0.4.1"
package_root = os.path.abspath(os.path.dirname(__file__))
diff --git a/tests/unit/gapic/admin_v1alpha/test_analytics_admin_service.py b/tests/unit/gapic/admin_v1alpha/test_analytics_admin_service.py
index 8ed45c01..ceb4446b 100644
--- a/tests/unit/gapic/admin_v1alpha/test_analytics_admin_service.py
+++ b/tests/unit/gapic/admin_v1alpha/test_analytics_admin_service.py
@@ -136,7 +136,25 @@ def test_analytics_admin_service_client_service_account_always_use_jwt(client_cl
) as use_jwt:
creds = service_account.Credentials(None, None, None)
client = client_class(credentials=creds)
- use_jwt.assert_called_with(True)
+ use_jwt.assert_not_called()
+
+
+@pytest.mark.parametrize(
+ "transport_class,transport_name",
+ [
+ (transports.AnalyticsAdminServiceGrpcTransport, "grpc"),
+ (transports.AnalyticsAdminServiceGrpcAsyncIOTransport, "grpc_asyncio"),
+ ],
+)
+def test_analytics_admin_service_client_service_account_always_use_jwt_true(
+ transport_class, transport_name
+):
+ with mock.patch.object(
+ service_account.Credentials, "with_always_use_jwt_access", create=True
+ ) as use_jwt:
+ creds = service_account.Credentials(None, None, None)
+ transport = transport_class(credentials=creds, always_use_jwt_access=True)
+ use_jwt.assert_called_once_with(True)
@pytest.mark.parametrize(
@@ -18338,12 +18356,7 @@ def test_analytics_admin_service_grpc_transport_client_cert_source_for_mtls(
"squid.clam.whelk:443",
credentials=cred,
credentials_file=None,
- scopes=(
- "https://www.googleapis.com/auth/analytics.edit",
- "https://www.googleapis.com/auth/analytics.manage.users",
- "https://www.googleapis.com/auth/analytics.manage.users.readonly",
- "https://www.googleapis.com/auth/analytics.readonly",
- ),
+ scopes=None,
ssl_credentials=mock_ssl_channel_creds,
quota_project_id=None,
options=[
@@ -18452,12 +18465,7 @@ def test_analytics_admin_service_transport_channel_mtls_with_client_cert_source(
"mtls.squid.clam.whelk:443",
credentials=cred,
credentials_file=None,
- scopes=(
- "https://www.googleapis.com/auth/analytics.edit",
- "https://www.googleapis.com/auth/analytics.manage.users",
- "https://www.googleapis.com/auth/analytics.manage.users.readonly",
- "https://www.googleapis.com/auth/analytics.readonly",
- ),
+ scopes=None,
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
options=[
@@ -18504,12 +18512,7 @@ def test_analytics_admin_service_transport_channel_mtls_with_adc(transport_class
"mtls.squid.clam.whelk:443",
credentials=mock_cred,
credentials_file=None,
- scopes=(
- "https://www.googleapis.com/auth/analytics.edit",
- "https://www.googleapis.com/auth/analytics.manage.users",
- "https://www.googleapis.com/auth/analytics.manage.users.readonly",
- "https://www.googleapis.com/auth/analytics.readonly",
- ),
+ scopes=None,
ssl_credentials=mock_ssl_cred,
quota_project_id=None,
options=[