gpt4 book ai didi

azure - 如何测试 Azure AD 访问 token 过期

转载 作者:行者123 更新时间:2023-12-02 23:01:11 25 4
gpt4 key购买 nike

我正在使用 this architecture 创建 Outlook 加载项.

我正在尝试处理 Azure Active Directory 访问 token 过期的情况。根据the official documentation , token 的生命周期为1小时。

因此,我正在考虑更改 token 的生命周期,如 this question 中所述。 。但我不能这样做,因为我无权编辑 Azure 策略。另外,我相信有一种更干净的方法来测试这种情况。

如何测试/调试这个场景?

最佳答案

每当您的访问 token 过期时,您都可以使用刷新 token 来交换新的访问/刷新 token 对。刷新 token 的最长不活动时间为 90 天。通过在发出请求时在范围参数中指定offline_access,您可以在请求访问 token 时在结果中获取刷新 token 。

curl --location --request POST 'https://login.microsoftonline.com/common/oauth2/v2.0/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id={clientid}' \
--data-urlencode 'refresh_token={refreshtoken}' \
--data-urlencode 'redirect_uri={redirect_uri}' \
--data-urlencode 'grant_type=refresh_token' \
--data-urlencode 'client_secret={client_secret}'

关于azure - 如何测试 Azure AD 访问 token 过期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48755981/

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