gpt4 book ai didi

Azure Oauth - 如何更改 token 过期时间?

转载 作者:行者123 更新时间:2023-12-01 08:54:23 26 4
gpt4 key购买 nike

我们正在将 Oauth2 与 Azure 结合使用。默认情况下,服务器返回 token , token 的过期时间间隔为一小时。有什么办法可以改变过期时间吗?

最佳答案

现在可以配置 token 生命周期。您可以在这里阅读更多信息:https://learn.microsoft.com/en-us/azure/active-directory/develop/active-directory-configurable-token-lifetimes .

备注:此功能处于预览阶段,不会以这种方式投入生产。以下标题也放置在我上面提到的文档链接上。

After hearing from customers during the preview, we're planning to replace this functionality with a new feature in Azure Active Directory Conditional Access. Once the new feature is complete, this functionality will eventually be deprecated after a notification period. If you use the Configurable Token Lifetime policy, be prepared to switch to the new Conditional Access feature once it's available.

原答案:

目前无法更改过期间隔。这些是当前的到期时间。

  • 最近 1 小时的访问 token

  • 刷新 token 的有效期为 14 天,但是

    • 如果您在这 14 天内使用了刷新 token ,您将收到一个新的 token ,其新的有效期窗口将再提前 14 天。您可以在最多 90 天的总有效期内重复此技巧,然后您必须重新进行身份验证
    • 刷新 token 可以随时失效,原因与您的应用无关(例如用户更改密码)。因此,您不应该在代码中依赖上述内容 - 您的逻辑应该始终假设刷新 token 可能随时失败
    • 访客 MSA 帐户的刷新 token 问题仅持续 12 小时

来源:http://www.cloudidentity.com/blog/2015/03/20/azure-ad-token-lifetime/还有我自己的经历。

关于Azure Oauth - 如何更改 token 过期时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31162257/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com