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

Commit

Permalink
Merge pull request #161 from yugangw-msft/cachecache
Browse files Browse the repository at this point in the history
fix an incorrect cache operation on authorization code flow
  • Loading branch information
rayluo authored Jun 26, 2018
2 parents f6db178 + 1686a2b commit 18a985c
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions adal/token_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,20 +319,14 @@ def get_token_with_client_credentials(self, client_secret):
def get_token_with_authorization_code(self, authorization_code, client_secret, code_verifier):

self._log.info("Getting token with auth code.")
try:
token = self._find_token_from_cache()
if token:
return token
except AdalError:
self._log.exception('Attempt to look for token in cache resulted in Error')
oauth_parameters = self._create_oauth_parameters(OAUTH2_GRANT_TYPE.AUTHORIZATION_CODE)
oauth_parameters[OAUTH2_PARAMETERS.CODE] = authorization_code
if client_secret is not None:
oauth_parameters[OAUTH2_PARAMETERS.CLIENT_SECRET] = client_secret
if code_verifier is not None:
oauth_parameters[OAUTH2_PARAMETERS.CODE_VERIFIER] = code_verifier
token = self._oauth_get_token(oauth_parameters)
self._cache_driver.add(token)
self._add_token_into_cache(token)
return token

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

0 comments on commit 18a985c

Please sign in to comment.