【发布时间】:2026-01-17 22:55:02
【问题描述】:
我正在使用 Python ADAL 库对使用 Azure Active Directory 的用户进行身份验证。我成功收到访问令牌后身份验证。现在,我想验证访问令牌的有效性。在这种情况下,我需要 ID_TOKEN。如何获得?
import adal
auth_context = adal.AuthenticationContext("https://login.microsoftonline.com/{{tenant_id}}")
token_response = auth_context.acquire_token_with_username_password("https://management.core.windows.net/", username, password, client_id)
在令牌响应中,我得到了 access_token 和 refresh_token,但没有收到 id_token。在一个类似的问题之后,How to verify JWT id_token produced by MS Azure AD? 我使用代码来验证访问令牌,但我需要 ID_TOKEN。
任何关于获得这个的想法都会很棒。
【问题讨论】:
标签: python oauth oauth-2.0 azure-active-directory