Skip to content

Commit 84d521c

Browse files
CopilotbgavrilMS
andauthored
docs: clarify decode-only id token behavior
Agent-Logs-Url: https://github.com/AzureAD/microsoft-authentication-library-for-python/sessions/d56329c6-d8ad-4440-8617-3df24459fed0 Co-authored-by: bgavrilMS <12273384+bgavrilMS@users.noreply.github.com>
1 parent d0251ee commit 84d521c

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

msal/oauth2cli/oidc.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ def decode_id_token(id_token, client_id=None, issuer=None, nonce=None, now=None)
8181
per `specs <https://openid.net/specs/openid-connect-core-1_0.html#IDToken>`_
8282
and it may contain other optional content such as "preferred_username",
8383
`maybe more <https://openid.net/specs/openid-connect-core-1_0.html#Claims>`_
84+
85+
The optional parameters ``client_id``, ``issuer``, ``nonce``, and ``now``
86+
are ignored and only kept for backward compatibility.
8487
"""
8588
return json.loads(decode_part(id_token.split('.')[1]))
8689

@@ -144,9 +147,7 @@ def obtain_token_by_authorization_code(self, code, nonce=None, **kwargs):
144147
plus new parameter(s):
145148
146149
:param nonce:
147-
Optional. If you provided a nonce when calling
148-
:func:`build_auth_request_uri`, you may still pass it here for
149-
backward compatibility.
150+
Optional. Ignored and only kept for backward compatibility.
150151
"""
151152
warnings.warn(
152153
"Use obtain_token_by_auth_code_flow() instead", DeprecationWarning)

tests/test_oidc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def test_id_token_should_ignore_validation_parameters(self):
9999
), {
100100
"iss": "issuer",
101101
"iat": 1706570732,
102-
"exp": 1674948332, # 2023-1-28
102+
"exp": 1674948332, # 2023-01-28
103103
"aud": "foo",
104104
"sub": "subject",
105105
})

0 commit comments

Comments
 (0)