我如何获得刷新令牌 [英] how can I get refresh token

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

问题描述

我学习此代码示例: 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/zh-cn/library/microsoft.identitymodel.clients.activedirectory.authenticationcontext.acquiretokenbyrefreshtoken.aspx

推荐答案

ADAL 2.X中提供了acquiretokenbyrefreshtoken函数,该代码示例使用的是ADAL 3.13.8,并且从ADAL3.X开始,库不会公开刷新令牌和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天全站免登陆