Skip to content

Commit 386ea2e

Browse files
committed
Tolerate ID token time errors
1 parent ba3cec0 commit 386ea2e

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

docs/index.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,12 @@ New in MSAL Python 1.26
148148

149149
.. automethod:: __init__
150150

151+
152+
Exceptions
153+
----------
154+
These are exceptions that MSAL Python may raise.
155+
You should not need to create them directly.
156+
You may want to catch them to provide a better error message to your end users.
157+
158+
.. autoclass:: msal.IdTokenError
159+

msal/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
ConfidentialClientApplication,
3232
PublicClientApplication,
3333
)
34-
from .oauth2cli.oidc import Prompt
34+
from .oauth2cli.oidc import Prompt, IdTokenError
3535
from .token_cache import TokenCache, SerializableTokenCache
3636
from .auth_scheme import PopAuthScheme
37-

tests/test_oidc.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from tests import unittest
22

3-
import oauth2cli
3+
import msal
4+
from msal import oauth2cli
45

56

67
class TestIdToken(unittest.TestCase):
@@ -16,6 +17,6 @@ def test_id_token_should_tolerate_time_error(self):
1617
}, "id_token is decoded correctly, without raising exception")
1718

1819
def test_id_token_should_error_out_on_client_id_error(self):
19-
with self.assertRaises(oauth2cli.IdTokenError):
20+
with self.assertRaises(msal.IdTokenError):
2021
oauth2cli.oidc.decode_id_token(self.EXPIRED_ID_TOKEN, client_id="not foo")
2122

0 commit comments

Comments
 (0)