Skip to content

Commit e683ad9

Browse files
committed
implement user on credentical grant type. #6
1 parent 8d03cfb commit e683ad9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

flask_oauthlib/provider/oauth2.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,15 @@ def validate_grant_type(self, client_id, grant_type, client, request,
564564

565565
if hasattr(client, 'allowed_grant_types'):
566566
return grant_type in client.allowed_grant_types
567+
568+
if grant_type == 'client_credentials':
569+
# TODO: other means
570+
if hasattr(client, 'user'):
571+
request.user = client.user
572+
return True
573+
log.debug('Client should has a user property')
574+
return False
575+
567576
return True
568577

569578
def validate_redirect_uri(self, client_id, redirect_uri, request,

0 commit comments

Comments
 (0)