Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions flask_oauthlib/provider/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,15 @@ def client_authentication_required(self, request, *args, **kwargs):
.. _`Section 4.1.3`: http://tools.ietf.org/html/rfc6749#section-4.1.3
.. _`Section 6`: http://tools.ietf.org/html/rfc6749#section-6
"""

if request.grant_type == 'password':
return True
client = self._clientgetter(request.client_id)
if (not client) or client.client_type == 'confidential' or\
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for if-else. just return.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@landler, are you fixing this? Otherwise I will do it ;)

request.client_secret:
return True
else:
return False

auth_required = ('authorization_code', 'refresh_token')
return 'Authorization' in request.headers and\
request.grant_type in auth_required
Expand Down Expand Up @@ -631,10 +638,6 @@ def authenticate_client_id(self, client_id, request, *args, **kwargs):
log.debug('Authenticate failed, client not found.')
return False

if client.client_secret != request.client_secret:
log.debug('Authenticate client failed, secret not match.')
return False

# attach client on request for convenience
request.client = client
return True
Expand Down