From 3a3d3665362f0cf242c59ed74c7701c522c4c125 Mon Sep 17 00:00:00 2001 From: Sylvain MARIE Date: Thu, 9 Apr 2020 10:53:11 +0200 Subject: `LegacyApplicationClient.prepare_request_body` now honors the default scopes defined in client constructor if no explicit overridden `scope` argument is provided. Fixes #725 --- oauthlib/oauth2/rfc6749/clients/legacy_application.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/oauthlib/oauth2/rfc6749/clients/legacy_application.py b/oauthlib/oauth2/rfc6749/clients/legacy_application.py index 1bb0e14..f6acbc0 100644 --- a/oauthlib/oauth2/rfc6749/clients/legacy_application.py +++ b/oauthlib/oauth2/rfc6749/clients/legacy_application.py @@ -79,5 +79,8 @@ class LegacyApplicationClient(Client): """ kwargs['client_id'] = self.client_id kwargs['include_client_id'] = include_client_id + if scope is None: + # use default scopes + scope = self.scope return prepare_token_request(self.grant_type, body=body, username=username, password=password, scope=scope, **kwargs) -- cgit v1.2.1 From 32043a57f8f248539b12da93c031ec9470ea13fd Mon Sep 17 00:00:00 2001 From: Sylvain MARIE Date: Thu, 9 Apr 2020 10:58:35 +0200 Subject: Made code a one-liner for consistency with BackendApplicationClient --- oauthlib/oauth2/rfc6749/clients/legacy_application.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/oauthlib/oauth2/rfc6749/clients/legacy_application.py b/oauthlib/oauth2/rfc6749/clients/legacy_application.py index f6acbc0..fe2ff4a 100644 --- a/oauthlib/oauth2/rfc6749/clients/legacy_application.py +++ b/oauthlib/oauth2/rfc6749/clients/legacy_application.py @@ -79,8 +79,6 @@ class LegacyApplicationClient(Client): """ kwargs['client_id'] = self.client_id kwargs['include_client_id'] = include_client_id - if scope is None: - # use default scopes - scope = self.scope + scope = self.scope if scope is None else scope return prepare_token_request(self.grant_type, body=body, username=username, password=password, scope=scope, **kwargs) -- cgit v1.2.1 From 8b95eef71c586090674cdf2db7ff399618f068a4 Mon Sep 17 00:00:00 2001 From: Sylvain MARIE Date: Thu, 9 Apr 2020 10:59:29 +0200 Subject: changelog entry --- CHANGELOG.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ab556f1..633b70d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -25,8 +25,9 @@ OAuth2.0 Provider - Bugfixes OAuth2.0 Client - Bugfixes * #290: Fix Authorization Code's errors processing - * #603: BackendApplication.Client.prepare_request_body use the `scope` argument as intended. + * #603: BackendApplicationClient.prepare_request_body use the `scope` argument as intended. * #672: Fix edge case when `expires_in=Null` + * #725: LegacyApplicationClient.prepare_request_body now correctly uses the default `scope` provided in constructor OAuth1.0 Client -- cgit v1.2.1