File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ v1.3.2 (TBD)
66- ``OAuth2Session `` now correctly uses the ``self.verify `` value if ``verify ``
77 is not overridden in ``fetch_token `` and ``refresh_token ``. Fixes `#404
88 <https://github.com/requests/requests-oauthlib/issues/404> `_.
9+ - ``OAuth2Session `` constructor now uses its ``client.scope `` when a ``client ``
10+ is provided and ``scope `` is not overridden. Fixes `#408
11+ <https://github.com/requests/requests-oauthlib/issues/408> `_
912
1013v1.3.1 (21 January 2022)
1114++++++++++++++++++++++++
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ def __init__(
7777 super (OAuth2Session , self ).__init__ (** kwargs )
7878 self ._client = client or WebApplicationClient (client_id , token = token )
7979 self .token = token or {}
80- self .scope = scope
80+ self ._scope = scope
8181 self .redirect_uri = redirect_uri
8282 self .state = state or generate_token
8383 self ._state = state
@@ -97,6 +97,20 @@ def __init__(
9797 "protected_request" : set (),
9898 }
9999
100+ @property
101+ def scope (self ):
102+ """By default the scope from the client is used, except if overridden"""
103+ if self ._scope is not None :
104+ return self ._scope
105+ elif self ._client is not None :
106+ return self ._client .scope
107+ else :
108+ return None
109+
110+ @scope .setter
111+ def scope (self , scope ):
112+ self ._scope = scope
113+
100114 def new_state (self ):
101115 """Generates a state string to be used in authorizations."""
102116 try :
You can’t perform that action at this time.
0 commit comments