Skip to content

Commit fa7d9d6

Browse files
madawei2699lepture
authored andcommitted
[Fix Bug] When library call authenticate_client but client's secret key is null that can cause the program raise a 500 Internal Server Error. (lepture#258)
* [Fix Bug] When library call authenticate_client but client's secret key is null that can cause the program raise a 500 Internal Server Error. * [Fix Bug] When library call authenticate_client but client's secret key is null that can cause the program raise a 500 Internal Server Error.
1 parent 9db38f8 commit fa7d9d6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

flask_oauthlib/provider/oauth2.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -623,9 +623,11 @@ def authenticate_client(self, request, *args, **kwargs):
623623

624624
request.client = client
625625

626-
if client.client_secret != client_secret:
627-
log.debug('Authenticate client failed, secret not match.')
628-
return False
626+
# http://tools.ietf.org/html/rfc6749#section-2
627+
# The client MAY omit the parameter if the client secret is an empty string.
628+
if hasattr(client, 'client_secret') and client.client_secret != client_secret:
629+
log.debug('Authenticate client failed, secret not match.')
630+
return False
629631

630632
log.debug('Authenticate client success.')
631633
return True

0 commit comments

Comments
 (0)