Thanks to visit codestin.com
Credit goes to github.com

Skip to content

OAuth2 LegacyApplicationClient should honor default scopes in prepare_request_body #725

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
smarie opened this issue Apr 9, 2020 · 0 comments · Fixed by #726
Closed

OAuth2 LegacyApplicationClient should honor default scopes in prepare_request_body #725

smarie opened this issue Apr 9, 2020 · 0 comments · Fixed by #726
Labels
Bug OAuth2-Client This impact the client part of OAuth2.
Milestone

Comments

@smarie
Copy link

smarie commented Apr 9, 2020

Hi there,

I found this while using requests-oauthlib (requests/requests-oauthlib#406) but it actually belongs here.

Consider this code:

from oauthlib.oauth2 import LegacyApplicationClient
from requests_oauthlib import OAuth2Session

client = LegacyApplicationClient(client_id="my_client_id", scope=['openid', 'profile'])
oauth_session = OAuth2Session(client)

token = oauth_session.fetch_token(token_url='https://<blah>.auth0.com/oauth/ro',
                                                         username=username, password=password,
                                                         include_client_id=True,
                                                         scope=['openid', 'profile']  # this should not be needed
                                  )

I currently have to include the scope in fetch_token() to get a valid token, because the default scopes defined in LegacyApplicationClient are not used in LegacyApplicationClient.prepare_request_body(...) when scope=None is received.

I will submit a PR

smarie pushed a commit to smarie/oauthlib that referenced this issue Apr 9, 2020
… scopes defined in client constructor if no explicit overridden `scope` argument is provided. Fixes oauthlib#725
@JonathanHuot JonathanHuot added this to the 3.1.1 milestone Apr 17, 2020
@JonathanHuot JonathanHuot added Bug OAuth2-Client This impact the client part of OAuth2. labels Apr 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug OAuth2-Client This impact the client part of OAuth2.
Projects
None yet
2 participants