我怎样才能获得刷新令牌 [英] how can I get refresh token

查看:37
本文介绍了我怎样才能获得刷新令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

i learn this code sample :https://github.com/Azure-Samples/active-directory-dotnet-graphapi-web ,and yes ,i can get access token in AuthorizationCodeReceived : AuthenticationHelper.token = result.AccessToken;

但是我如何获取刷新令牌?result.RefreshToken 不可用,那么我如何使用acquiretokenbyrefreshtoken 功能?

but how do i get the refresh token ?result.RefreshToken is not available , then how do i use acquiretokenbyrefreshtoken function ?

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 函数.

The acquiretokenbyrefreshtoken function is available in ADAL 2.X , that code sample is using ADAL 3.13.8 , and from ADAL3.X, library won't expose refresh token and AuthenticationContext.AcquireTokenByRefreshToken function.

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

ADAL caches refresh token and will automatically use it whenever you call AcquireToken and the requested token need renewing(even you want to get new access token for different resource).

请参阅 这里 .也可以点击这里此处了解有关 ADAL 中刷新令牌的更多详细信息.

please see the explanation from here . Also click here and here for more details about refresh token in ADAL .

这篇关于我怎样才能获得刷新令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆