Skip to content

Conversation

prithvidasgupta
Copy link

@prithvidasgupta prithvidasgupta commented Sep 19, 2024

The fetch_token function calls the prepare_request_body function. However, it does not pass the scope initialized in the OAuth2Session class constructor. This leads to Missing access token error in cases where the scope is a required parameter. I believe explicitly passing it here makes sense.

This fix may be related to #324

Code used to test

import os from oauthlib.oauth2 import BackendApplicationClient from requests_oauthlib import OAuth2Session client_secret = os.environ['CLIENT_SECRET'] client_id = os.environ['CLIENT_ID'] token_url= os.environ['TOKEN_URL'] scope = ['examplescope'] client = BackendApplicationClient(client_id=client_id) oauth = OAuth2Session(client=client, scope=scope) token = oauth.fetch_token(token_url=token_url, client_id=client_id, client_secret=client_secret) 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant