diff --git a/requests_oauthlib/oauth2_session.py b/requests_oauthlib/oauth2_session.py index 93cc4d7..9a33945 100644 --- a/requests_oauthlib/oauth2_session.py +++ b/requests_oauthlib/oauth2_session.py @@ -349,11 +349,19 @@ def fetch_token( if client_secret is not None: kwargs["client_secret"] = client_secret + # Proritize the scope passed in constructor + # If not passed in constructor, use the kwargs scope if available + if 'scope' in kwargs: + scope = kwargs.pop('scope', None) + if self.scope == None: + self.scope = scope + body = self._client.prepare_request_body( code=code, body=body, redirect_uri=self.redirect_uri, include_client_id=include_client_id, + scope=self.scope, **kwargs )