gpt4 book ai didi

azure-active-directory - 我怎样才能获得刷新 token

转载 作者:行者123 更新时间:2023-12-03 16:55:07 27 4
gpt4 key购买 nike

我学习了这个代码示例:https://github.com/Azure-Samples/active-directory-dotnet-graphapi-web ,是的,我可以在 AuthorizationCodeReceived 中获取访问 token :
AuthenticationHelper.token = result.AccessToken;

但是我如何获得刷新 token ?result.RefreshToken 不可用,那么我如何使用acquiretokenbyrefreshtoken 函数?

https://msdn.microsoft.com/en-us/library/microsoft.identitymodel.clients.activedirectory.authenticationcontext.acquiretokenbyrefreshtoken.aspx

最佳答案

Acquiretokenbyrefreshtoken 函数在 ADAL 2.X 中可用,该代码示例使用 ADAL 3.13.8,从 ADAL3.X 开始,库不会公开刷新 token 和 AuthenticationContext.AcquireTokenByRefreshToken 函数。

ADAL 缓存刷新 token ,并会在您调用 AcquireToken 并且请求的 token 需要更新时自动使用它(即使您想为不同的资源获取新的访问 token )。

请看here的解释.也点击herehere有关 ADAL 中刷新 token 的更多详细信息。

关于azure-active-directory - 我怎样才能获得刷新 token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42920678/

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