Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Address PR Comments
  • Loading branch information
bgavrilMS committed Sep 23, 2019
commit 9bb023d6c383542939170321535815eb14494ce4
2 changes: 1 addition & 1 deletion msal/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ def _acquire_token_silent_from_cache_and_possibly_refresh_it(
logger.debug("Cache hit an AT")
return { # Mimic a real response
"access_token": entry["secret"],
"token_type": entry["token_type"] or "Bearer",
"token_type": entry.get("token_type", "Bearer"),
"expires_in": int(expires_in), # OAuth2 specs defines it as int
}
return self._acquire_token_silent_by_finding_rt_belongs_to_me_or_my_family(
Expand Down
6 changes: 3 additions & 3 deletions msal/token_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@ def __add(self, event, now=None):
"client_id": event.get("client_id"),
"target": target,
"realm": realm,
"token_type": response.get("token_type") or "Bearer",
"token_type": response.get("token_type", "Bearer"),
"cached_at": str(now), # Schema defines it as a string
"expires_on": str(now + expires_in), # Same here
"extended_expires_on": str(now + ext_expires_in) # Same here
}
"extended_expires_on": str(now + ext_expires_in) # Same here
}
self.modify(self.CredentialType.ACCESS_TOKEN, at, at)

if client_info:
Expand Down
5 changes: 1 addition & 4 deletions tests/test_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ def setUp(self):
self.client_id = "my_app"
self.access_token = "access token for testing authority aliases"
self.cache = msal.SerializableTokenCache()
self.token_type = "some_other_token_type"
self.cache.add({
"client_id": self.client_id,
"scope": self.scopes,
Expand Down Expand Up @@ -196,6 +195,4 @@ def test_acquire_token_silent(self):
authority=self.authority_url_in_app, token_cache=self.cache)
at = app.acquire_token_silent(self.scopes, self.account)
self.assertNotEqual(None, at)
self.assertEqual(self.access_token, at.get('access_token'))
self.assertEqual(self.token_type, at.get('token_type'))

self.assertEqual(self.access_token, at.get('access_token'))