Skip to content

Commit

Permalink
Add support for password grant (#6)
Browse files Browse the repository at this point in the history
Thanks to @scranen
  • Loading branch information
scranen authored and Peter Slump committed Nov 27, 2018
1 parent 1f859c6 commit 2557169
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/keycloak/openid_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,20 @@ def authorization_code(self, code, redirect_uri):
return self._token_request(grant_type='authorization_code', code=code,
redirect_uri=redirect_uri)

def password_credentials(self, username, password, **kwargs):
"""
Retrieve access token by 'password credentials' grant.
https://tools.ietf.org/html/rfc6749#section-4.3
:param str username: The user name to obtain an access token for
:param str password: The user's password
:rtype: dict
:return: Access token response
"""
return self._token_request(grant_type='password',
username=username, password=password, **kwargs)

def client_credentials(self, **kwargs):
"""
Retrieve access token by `client_credentials` grant.
Expand Down

0 comments on commit 2557169

Please sign in to comment.