Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Adding auth code flow support for public client #149

Merged
merged 3 commits into from
May 18, 2018
Merged
Show file tree
Hide file tree
Changes from 2 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
9 changes: 6 additions & 3 deletions adal/authentication_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def token_func(self):

def acquire_token_with_authorization_code(self, authorization_code,
redirect_uri, resource,
client_id, client_secret):
client_id, client_secret=None):
'''Gets a token for a given resource via auhtorization code for a
server app.

Expand All @@ -180,8 +180,11 @@ def acquire_token_with_authorization_code(self, authorization_code,
:param str resource: A URI that identifies the resource for which the
token is valid.
:param str client_id: The OAuth client id of the calling application.
:param str client_secret: The OAuth client secret of the calling
application.
:param str client_secret: (only for confidential clients)The OAuth
client secret of the calling application.
:param str code_verifier: (optional)The code verifier that was used to
Copy link
Collaborator

@rayluo rayluo May 17, 2018

Choose a reason for hiding this comment

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

Please remove this document too. We don't need it yet. :-)

Also github detects there will be a merge conflict for this PR. And that is because this branch was created from an older dev branch. So another learning experience here: always do git pull origin dev first, before you do git checkout -b my-cool-new-feature.

obtain authorization code if PKCE was used in the authorization
code grant request.(usually used by public clients)
:returns: dict with several keys, include "accessToken" and
"refreshToken".
'''
Expand Down
4 changes: 2 additions & 2 deletions adal/token_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,8 @@ def get_token_with_authorization_code(self, authorization_code, client_secret):

oauth_parameters = self._create_oauth_parameters(OAUTH2_GRANT_TYPE.AUTHORIZATION_CODE)
oauth_parameters[OAUTH2_PARAMETERS.CODE] = authorization_code
oauth_parameters[OAUTH2_PARAMETERS.CLIENT_SECRET] = client_secret

if client_secret is not None:
oauth_parameters[OAUTH2_PARAMETERS.CLIENT_SECRET] = client_secret
return self._oauth_get_token(oauth_parameters)

def _get_token_with_refresh_token(self, refresh_token, resource, client_secret):
Expand Down