在试图找到一种方法来最大化用户必须进行重新验证的时间(尤其是在用户进行社交登录的情况下,例如与Microsoft登录)。
我偶然发现了这份Microsoft文档,该文档陈述了令牌的寿命。
Microsoft Docs-代币寿命
以及这些MSAL文档(这是我在Web应用程序上使用的库)
msal docs- token lifetimes
这两个来源的国家限制我都被发现是我的 。不正确:
Microsoft文档
token_lifetime_secs-访问令牌寿命(秒)。默认值为3,600(1小时)。最低为300(5分钟)。最大值为86,400(24小时)。
我发现,在上传B2C策略时,有一个验证,该验证表示以下内容。
访问令牌的寿命应在5分钟至10080分钟之间
的Access_token寿命
,请发出B2C令牌作为水疗登录流的一部分,我能够解码Access_Token,该访问_Token具有7天的寿命,直到发行
这与Microsoft文档冲突,即Access_token Lifetime限制为24小时。
有人有经验吗,访问令牌的真正寿命是什么?
如果我将此Access_Token存储在本地存储中,则用户将在接下来的7天内进行持续的会话?因为我从MSAL文档中了解到,只要访问_token未过期,就不会使用refresh_token(此refresh_token的寿命为24h不可扩展,并且独立于以前完成了多少刷新),因此用户是用户将保持对7天应用程序的访问,而无需重新验证。
B2C自定义策略会话的生命周期如何在这里发挥作用?
自定义政策会话寿命与访问令牌和MSAL的关系是什么?
While trying to find a way to maximize the time before a user has to do a reauthentication (especially in cases when the user does a social login, e.g. sign in with microsoft).
I have stumbled upon this microsoft documentation which states token lifetimes.
Microsoft docs - token lifetimes
As well as these MSAL docs (which is the library that I use on my web application)
MSAL docs - token lifetimes
Both of these sources state limitations I have found to be not true:
Microsoft docs
token_lifetime_secs - Access token lifetimes (seconds). The default is 3,600 (1 hour). The minimum is 300 (5 minutes). The maximum is 86,400 (24 hours).
I have found that while uploading the B2C policy there is a validation which states the following.
The access token lifetime should be between 5 minutes and 10080 minutes

Setting this up, issuing a B2C token as a part of a SPA login flow I was able to decode an access_token which has a lifetime of 7 days until moment of issue

This conflicts with the Microsoft docs that the access_token lifetime is limited to 24 hours.
Does anyone have experience with this, what is the real lifetime of the access token?
If I store this access_token in local storage will the user have a persisted session for the next 7 days? Because as I understand from the MSAL docs, as long as the access_token is not expired, a refresh_token will not be used (this refresh_token has a lifetime of 24h non-extendable, and independent on how many refreshes were done previously) and thus the user will maintain access to the app of 7 days without the need to reauthenticate.
How does the B2C custom policy session lifetime come into play here?
What is the relationship of the custom policy session lifetime to the access token and MSAL?
发布评论
评论(2)
按照 this this
: & ID代币寿命(分钟) - 用于访问受保护的资源的OAUTH 2.0载体代币的寿命为60分钟。 “
并且按照这是一个特殊情况。您正在使用PKCE吗?
另外,是否更改了令牌寿命的配置?
As per this:
"Access & ID token lifetimes (minutes) - The lifetime of the OAuth 2.0 bearer token used to gain access to a protected resource. The default is 60 minutes. The minimum (inclusive) is 5 minutes. The maximum (inclusive) is 1440 minutes."
And as per this, SPA are a special case. Are you using PKCE?
Also, has the configuration of token lifetimes been changed?
我有完全相同的经验,并在GitHub文档页面上创建了一个问题:
I had the exact same experience and created an issue on the GitHub documentation page: https://github.com/MicrosoftDocs/azure-docs/issues/109838