Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Authentication timeout in a flow that uses `max_age` parameter has a 'send another authorisation code' button that doesn't allow login

未关闭
#455 14 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
python

调研方向

Start by reading ConfidentialClientApplication.initiate_auth_code_flow and tracing how max_age and auth_time are checked across the password and MFA steps. Reproduce the reported delay between password entry and MFA, then compare the behavior with a fresh attempt after cancellation. Done means the timeout flow allows a valid MFA retry or requests password and MFA again without raising the reported error.

由索引模型根据 Issue 内容生成。

描述

external question

Describe the bug
The optional max_age parameter in the ConfidentialClientApplication. initiate_auth_code_flow is compared against the time the user entered their password instead of the full authentication with the MFA, which leads to odd behaviours for authentication timeout. A user that takes to long to enter the MFA sees a 'this has timed-out, send another authorization code' but entering the MFA again will not work because the time will be past the max_age, so an error will be raised instead.

To Reproduce
Steps to reproduce the behavior:

  1. Initiate a auth code flow with the max_age parameter set to 60 seconds (for example)
  2. I enter my password, but don't enter my MFA devices for a couple of minutes
  3. I see that too much time has passed and a button saying 'send another authorisation code'
  4. I press on that 'send another authorization code' button

Expected behavior
I would expect one of two behaviors:

  • I re-enter my MFA code and I can login
  • I am asked to re-enter my password and MFA and I can login

What you see instead
I re-enter my MFA code and a python error is raised:
RuntimeError( RuntimeError: 13. auth_time (1642085298) was requested, by using max_age (60) parameter, and now (1642085502) too much time has elasped since last end-user authentication.

The MSAL Python version you are using
1.16.0

Additional context
If a user takes too long to enter their password everything works fine since the max_age is evaluated since the password was entered. This is only an issue if the user takes to long to add their MFA code.
This flow is also fine if after I enter my password and take too long to enter my MFA code, I click on 'cancel' and then try again, and it will ask for my password + MFA again.

主要语言
Python
星标
971
派生
223
平均合并
13 小时 48 分钟
30 天内合并 PR
2

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

AzureAD/microsoft-authentication-library-for-python 的其他 Issue

查看 AzureAD/microsoft-authentication-library-for-python 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。