gpt4 book ai didi

azure - 为什么 AzureServiceTokenProvider 返回过期的访问 token ?

转载 作者:行者123 更新时间:2023-12-03 03:51:38 29 4
gpt4 key购买 nike

我尝试使用 AzureServiceTokenProvider 获取访问 token 来调用自定义服务,但它间歇性地返回过期的 token 。我了解 AzureServiceTokenProvider caches the token and retrieves a new one before expiration ,但这是全新调试 session 中的全新 token 。调试 session 示例:

当前 UTC 时间:2021 年 3 月 6 日 5:57:16 AM

enter image description here

但是返回的token已经过期了?? 世界标准时间 2021 年 3 月 6 日上午 5:27:40

enter image description here

我在本地和部署到 Azure 时都会遇到此行为,但它是间歇性的。

更新:我还根据https://github.com/Azure/azure-sdk-for-net/issues/16718的建议尝试了将forceRefresh设置为true的GetAuthenticationResultAsync。但仍然获得了相同日期 3/6/2021 5:27:40 AM 的过期 token 。

最佳答案

很难说问题是什么。最好的猜测是获取新 token 的调用失败,因此返回缓存的 token 。

但是,正如您问题中的链接所述,此方法是旧方法,不再推荐。

因此,您可以通过切换到 Azure Identity 客户端库来“解决”该问题 https://learn.microsoft.com/en-us/dotnet/api/overview/azure/identity-readme

关于azure - 为什么 AzureServiceTokenProvider 返回过期的访问 token ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66502950/

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